Outputting a string depending on the color detected in a frame a video feed

Hi, so what I'm trying to do is output a certain string depending on the color I see in the video feed. For right now, what I've done is threshold the feed so that everything above a certain brightness shows up as Red. Now I want to have something that says if there's any red in the feed, then I output a "1" to a text box on my user interface that's showing the feed. If there is no red, then I output a "0" to the text box. I'm using Emgu CV C ++ with VS2010, can anyone help me? Thank you.

This is the code I have so far that isn't working correctly, it's giving me a compiler error.

1
2
3
4
5
6
7
8
9
10
11
12
13
cvConvertScaleAbs(frameFromCamera->Ptr.ToPointer(),frameDisplay->Ptr.ToPointer(),double(1)/16,0);
		cvCvtColor(frameDisplay->Ptr.ToPointer(),frameColorDisplay->Ptr.ToPointer(),CV_GRAY2BGR);
		cvThreshold(frameDisplay->Ptr.ToPointer(),maskSaturated->Ptr.ToPointer(),200,255,CV_THRESH_BINARY);
		cvNot(maskSaturated->Ptr.ToPointer(),mask1->Ptr.ToPointer());
		cv::Scalar red(0,0,255);
		cvSet(frameColorDisplay->Ptr.ToPointer(),red,maskSaturated->Ptr.ToPointer());
		imageMain->Image=frameColorDisplay;
		if(frameFromCamera->InRange(new Bgr(0, 0, 200),new Bgr(0, 0, 255)) == 255){
			tbMorse->Text ="1";
		}
		else{
			tbMorse->Text = "0";
		}


and the error it's giving me

1
2
3
4
5
6
7
8
9
10
BAOTFISInterface.cpp(1010): error C2664: 'Emgu::CV::Image<TColor,TDepth> ^Emgu::CV::Image<TColor,TDepth>::InRange(Emgu::CV::Image<TColor,TDepth> ^,Emgu::CV::Image<TColor,TDepth> ^)' : cannot convert parameter 1 from 'Emgu::CV::Structure::Bgr *' to 'Emgu::CV::Image<TColor,TDepth> ^'
          with
          [
              TColor=Emgu::CV::Structure::Gray,
              TDepth=unsigned char
          ]
          No user-defined-conversion operator available, or
          Cannot convert an unmanaged type to a managed type

Build FAILED.
This error seems pretty explicit on why it isn't working.

"cannot convert parameter 1 from 'Emgu::CV::Structure::Bgr *' to 'Emgu::CV::Image<TColor,TDepth> ^'"

"No user-defined-conversion operator available, or
Cannot convert an unmanaged type to a managed type"
Topic archived. No new replies allowed.