Unkown Exception being thrown when thresholding

Ask questions on using Emgu CV with C++
Post Reply
nboch12
Posts: 1
Joined: Wed Jul 16, 2014 9:51 am

Unkown Exception being thrown when thresholding

Post by nboch12 » Wed Jul 16, 2014 12:06 pm

So I'm trying to threshold a video feed, and I'm getting a weird Exception that shuts down my program. I'm very new to image processing so I have absolutely no idea what the problem could be. I'm running VS2010 in C++. Here's my code:
Emgu::CV::Image<Gray,UInt16> ^currentFrame;
Emgu::CV::Image<Gray,UInt16> ^threshFrame;
threshFrame = gcnew Emgu::CV::Image<Gray,UInt16>(cols,rows);
currentFrame=frameFromCamera_static->Clone();
CvInvoke::cvThreshold(currentFrame, threshFrame, 160, 255, (Emgu::CV::CvEnum::THRESH)CV_THRESH_BINARY);
CvInvoke::cvShowImage("Output", threshFrame);
int c = cvWaitKey(40);
The exception I'm getting is this:

An unhandled exception of type 'Emgu.CV.CvException' occurred in Emgu.CV.dll

Additional information: OpenCV:

As you can see, the "Additional information" doesn't really offer much in terms of additional information. I'm very confused and very frustrated so if anyone could help me out that would be phenomenal. Thank you!

JacobChrist
Posts: 5
Joined: Mon Sep 08, 2014 6:19 pm

Re: Unkown Exception being thrown when thresholding

Post by JacobChrist » Tue Sep 09, 2014 4:30 pm

Have you tried C#? I have this code working:

Code: Select all

  imgSmoothed = imgSmoothed.ThresholdBinary(new Bgr(15, 15, 15), new Bgr(255, 255, 255));
Also, it seems like with a binary threshold that you don't need two pass two images, but I'm as green as you are if not more so.

Jacob

Post Reply