大家好我这个代码有问题
if(cbFilterOnColor.Checked == true)
{
imgGrayColorFiltered == imgSmoothed.InRange(new Bgr(dblMinBlue, dblMinGreen, dblMinRed), new Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed));
}
我有一个错误告诉我:"只有赋值调用增量递减和新对象表达式可以用作语句"
我该怎么办......
dblMax和dblMin是填充的组合框,编号从0到255.而imgGrayColorFiltered的类型为Image<Bgr, Byte>
PS:我想将其从VB转换为c#
imgGrayColorFiltered = imgSmoothed.InRange(New Bgr(dblMinBlue, dblMinGreen, dblMinRed), New Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed))
答案 0 :(得分:3)
分配变量使用单个=。
if (cbFilterOnColor.Checked)
{
imgGrayColorFiltered = imgSmoothed.InRange(new Bgr(dblMinBlue, dblMinGreen, dblMinRed), new Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed));
}