I need to do image processing to inverse a stretching that is caused by object movement while camera is taking picture.
The target resulting image is looking like this.
A.
My current image is looking like this. I cannot really clearly make the item, but i Hope it can illustrate it. In this image,
the top part is stretched but the bottom part is not stretched
B.
My thought process is to
- detect the left facing and right facing lines.
- mirror the right facing line so I can average the coordinates between those two (left and right).
- image processing to resize the image so that the downward stretching part could be shorter (make the line straight again).
The 3rd part is done. The 2nd part, i can make do on it
I am having trouble for the first part.
how can I detect the left and right lines?
After do some thresholding, I can locate the black pixels, but I am not sure how to identify the left facing and right facing lines.
- extra info for my thought process
For process 2, since it is a pattern, left and right lines should and are the same (they are a mesh pattern with same gradient). In every height in the image, they should be the same.
For process 3, in my image, the stretched part is stretched downward. This could be done by getting the gradient of the line from the unstretched part. Then use image processing to resize the shorten the stretched part, so that the gradient become the same.
8