How to obtain cordinates at which abrupt chnage in pixel occurs?

I have an image in which there is a a white box. moving from top to bottom(height) I want to get the coordinates of first horizontal line and bottom horizontal line of the box using sudden change in pixel values
How do achieve this?
Screenshot 2020-05-28 at 11.34.07 AM

I’m not sure, if you would like to use a neural network for it, as you are posting in the PyTorch forum, but you could use standard image processing to get these lines.
To do so you could use a horizontal edge detection, e.g. using a sobel operator, and afterwards filter the image for these two lines (e.g. using a matched filter).

This could also be done using a neural network (which might be a bit overkill, but seems to be a fun task), so let me know, which approach you would like to take.

1 Like

Yes i did few image processing hack to get the results.
@ptrblck I would like to know how it can be done with using a neural network!

You could use your image processing approach to create the target values (e.g. as pixel locations of the start and end coordinates of the wanted lines or alternatively as a mask image) and start building a CNN to predict these targets.

I don’t know which target format and architecture would work the best, so you would have a lot to experiment with. :slight_smile: