Extract area inside rectangle

asked 2016-10-11 01:29:19 -0500

Atado gravatar image


i have some Bitmaps in an Android App which always contain some kind of rectangle in the right part of the image. The rectangle is not fully closed tho. Inside this rectangle theres some numbers. Basically i want to delete everything in that image except for the part inside the rectangle.

Example image: Input

Now i would like to detect the rectangle on the right and just keep the stuff inside it. So basically just the things inside the red box: Output

Since im new to OpenCV i dont really have an idea whats the best way of doing this. Maybe its important to say, that the images can also be slighty rotated so the rectangle is not always perfect horizontally or at the exact same spot.

Hope you can give me some tips how to accomplish this. Best regards

edit retag flag offensive close merge delete


My guess is, that you could solve this with calculating the Orientation/Magnitude of the Image. But before trying that, read this. If your image looks exactly like what you show us as example, you should have values at the rectangle in the gradient and the Magnitude.

Vintez gravatar imageVintez ( 2016-10-11 04:04:22 -0500 )edit