In the binary image, the plotted line represents the line of symmetry. The task is to make 25 columns left and right to the line of symmetry as 0 with the line of symmetry also invisible(i.e. value 0).
I have tried the following approach:
Since, x and y values of line of symmetry are in double, it shows the error: "Array indices must be positive integers or logical values." Converting x,y to uint8 would change its value.
y = slope * (x - xCentroid) + yCentroid;
outside = (y < 1) | (y > rows);
plot(x, y, 'r-', 'LineWidth', 2);
idx = sub2ind(size(Image),x,y);