a figure for instance of size 500*500 has half above part with black and below half white should result in a white line where the white meets the black (something like a single line at line 250 with pixels as 255) on convolution with a matrix. I am trying to make a matrix, but not able to visualise how the matrix would be? can some one help me build the matrix for this
You have to make all the values zero in the matrix except the middle row and thus, what you can start thinking is how to get such filter matrix which can give you this result. One of the many filter matrices you can think of, which satisfy your requirements is [0 1 0;0 0 0;0 -1 0].