How to crop along a yellow frame
Posted: 2019-08-29T18:44:41-07:00
We captured thousands of pictures of an object. That object had to be placed within a yellow frame, so that it does not touches the yellow frame.
I wanted to crop exactly the picture at that frame, but the frame moved over the time and even tilted slightly. I need a smarter way to crop.
Some notes. The frame is about 6x6 cm and the yellow frame is about 1.5 cm thick. The object is about 4x4 cm
I want to scan the picture to find the inner corners of the frame. The background is green, the frame is yellow. When the line changes from only green to yellow we start to find the line which gets interrupted by green - we are now at a line which sees the inner part of the frame. The first line where a yellow pixel is missing in the line, is a corner. Further scanning would reveal the next corners, just by interpreting where the green dot appears in the yellow line. In a perfected aligned frame the left and right corner would be found at once.
When I got these 4 corners, I want to crop the picture accordingly.
A python program captures the pictures in the first place. It would be great if we could find a way to crop it before it would be saved.
How can I do that?
I wanted to crop exactly the picture at that frame, but the frame moved over the time and even tilted slightly. I need a smarter way to crop.
Some notes. The frame is about 6x6 cm and the yellow frame is about 1.5 cm thick. The object is about 4x4 cm
I want to scan the picture to find the inner corners of the frame. The background is green, the frame is yellow. When the line changes from only green to yellow we start to find the line which gets interrupted by green - we are now at a line which sees the inner part of the frame. The first line where a yellow pixel is missing in the line, is a corner. Further scanning would reveal the next corners, just by interpreting where the green dot appears in the yellow line. In a perfected aligned frame the left and right corner would be found at once.
When I got these 4 corners, I want to crop the picture accordingly.
A python program captures the pictures in the first place. It would be great if we could find a way to crop it before it would be saved.
How can I do that?