Ask Your Question

Error left operand must be l-value

asked 2013-06-01 11:10:48 -0600

william gravatar image

updated 2013-06-01 13:00:04 -0600

Guanta gravatar image

Hi, please help.

I got an error while building my program: "error C2106: '=' : left operand must be l-value". Actually i want to assign first pixel of Output_image with first pixel of 3x3 Gaussian mask, then second pixel of Output_image with second pixel of 5x5 Gausssian mask and so on. I figure that the problem come from the line [int(<uchar>(x,y)) = int(<uchar>(x,y))] for the program shown below:


for(int x=0; x<image_height; x++)
        for(int y=0; y<image_width; y++)
              int(<uchar>(x,y)) = int(<uchar>(x,y));
            else if (y%2==1)
              int(<uchar>(x,y)) = int(<uchar>(x,y));

Is it correct for me to assign [int(<uchar>(x,y)) = int(<uchar>(x,y))]? Please advise me on how to solve the above error.

Thamk you very much.

edit retag flag offensive close merge delete


int() ??!! please try:<uchar>(x,y) =<uchar>(x,y) .

Offtopic: typically you take y-index for the rows (=height) and x-index for the columns (=width).

Guanta gravatar imageGuanta ( 2013-06-01 13:04:36 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-01 14:30:09 -0600

unxnut gravatar image

updated 2013-06-01 14:35:10 -0600

Remove the int around<uchar>(x,y).

Another stylistic thing:<uchar>(x,y) = ( y % 2 ) ?<uchar>(x,y) :<uchar>(x,y);

edit flag offensive delete link more

Question Tools


Asked: 2013-06-01 11:10:48 -0600

Seen: 437 times

Last updated: Jun 01 '13