Apuna12
Apuna12

Reputation: 239

correct conversion fom Vb to c#

hi guys i have a problem with this code

if(cbFilterOnColor.Checked == true)
        {
            imgGrayColorFiltered == imgSmoothed.InRange(new Bgr(dblMinBlue, dblMinGreen, dblMinRed), new Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed));
        }

I have an error which tells me this : "only assignment call increment decrement and new object expressions can be used as a statement"

what can i do with this...

dblMax and dblMin are filled comboboxes with numbers from 0 to 255. And imgGrayColorFiltered is type of Image<Bgr, Byte>

PS: i wanted to transform this from VB to c#

imgGrayColorFiltered = imgSmoothed.InRange(New Bgr(dblMinBlue, dblMinGreen, dblMinRed), New Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed))

Upvotes: 0

Views: 91

Answers (1)

Nicolas C
Nicolas C

Reputation: 754

To assign a variable use a single =.

if (cbFilterOnColor.Checked)
{
    imgGrayColorFiltered = imgSmoothed.InRange(new Bgr(dblMinBlue, dblMinGreen, dblMinRed), new Bgr(dblMaxBlue, dblMaxGreen, dblMaxRed));
}

Upvotes: 3

Related Questions