Hi,
I am trying to fill holes in an object. The theory is if the current pixel is 0 (black), the pixel to the left (previous column) is 1 (white) and the pixel above (previous row) is 1, then the current pixel value should be changed to 1. I implemented that with the following program, but it returns the warning: expression has no effect.
void image_fill( unsigned char * i_data, unsigned char * o_data, int cols, int rows )
{
int i=0; int j=0;
for (i = 1; i < rows; i++) {
for (j = 1; j < cols; j++) {
o_data[i,j] = (i_data[i,j] == 0 && i_data[i,j-1] == 255 && i_data[i-1,j] == 255) ? 255 : 0; <-- this line
} } }
I tried replacing the line with a more conventional method, but it also gives the same warning.
if (i_data[i,j] == 0 && i_data[i,j-1] == 255 && i_data[i-1,j] == 255) {
o_data[i,j] = 255; }
How do I proceed?
Thanks.
Hanief