所以我要做的是输出一个字符串,具体取决于我在视频Feed中看到的颜色。就目前而言,我所做的就是确定Feed的阈值,使高于某个亮度的所有内容都显示为红色。现在我想要一些东西,说明如果Feed中有任何红色,那么我会在我的用户界面上显示Feed的文本框中输出“1”。如果没有红色,则输出“0”到文本框。我在VS2010上使用Emgu CV Managed C ++,任何人都可以帮助我吗?谢谢。
这是我到目前为止无法正常工作的代码,它给了我一个编译器错误。
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());
highColor = gcnew Emgu::CV::Image<Bgr,UInt16>(0, 0, 255);
lowColor = gcnew Emgu::CV::Image<Bgr,UInt16>(0, 0, 200);
if(maskSaturated->InRange(lowColor, highColor) == 255){
tbMorse->Text ="1";
}
else{
tbMorse->Text = "0";
}
imageMain->Image=frameColorDisplay;
我在我的标题中初始化了highColor和lowColor
Emgu::CV::Image<Bgr,UInt16> ^lowColor;
Emgu::CV::Image<Bgr,UInt16> ^highColor;
并且它给我的错误是
BAOTFISInterface.cpp(1010): error C2664: 'Emgu::CV::Image<TColor,TDepth>::Image(int,int,Emgu::CV::Structure::Bgr)' : cannot convert parameter 3 from 'int' to 'Emgu::CV::Structure::Bgr'
with
[
TColor=Emgu::CV::Structure::Bgr,
TDepth=unsigned short
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
BAOTFISInterface.cpp(1011): error C2664: 'Emgu::CV::Image<TColor,TDepth>::Image(int,int,Emgu::CV::Structure::Bgr)' : cannot convert parameter 3 from 'int' to 'Emgu::CV::Structure::Bgr'
with
[
TColor=Emgu::CV::Structure::Bgr,
TDepth=unsigned short
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
BAOTFISInterface.cpp(1013): 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::Image<TColor,TDepth> ^' to 'Emgu::CV::Image<TColor,TDepth> ^'
with
[
TColor=Emgu::CV::Structure::Gray,
TDepth=unsigned char
]
and
[
TColor=Emgu::CV::Structure::Bgr,
TDepth=unsigned short
]
and
[
TColor=Emgu::CV::Structure::Gray,
TDepth=unsigned char
]
No user-defined-conversion operator available, or
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast