Ask Your Question
0

Finding region of interest with a known pattern

asked 2015-02-17 00:29:48 -0600

topShelf gravatar image

updated 2015-02-17 21:48:26 -0600

I want to do some image processing on two photos of the same object taken x amount of time apart and likely from varying angles and light. Fortunately there is a well defined region of interest in the photo indicated by a white square with a black cross (+) through the region. See the image below.

image description

In both photos I want to find and crop the ROI then perform a perspective transform.

I'm not new to opencv, but i'm no expert either. I was hoping to start a discussion about the best way to find the ROI given its simple shape. My initial idea was to use some sort of high pass filter with a kernel that looked like this:

k = [0 1 0
     1 1 1
     0 1 0]

But I have not used any similar methods like this before and I have a feeling this would fail if the ROI was not exactly square in the initial image. I also considered using contours with an algorithm to find that specific shape, as well as feature matching. I am sure there are better methods though, can someone please enlighten me :)

edit retag flag offensive close merge delete

Comments

1

if you could add some pictures, I am sure that this would simplify your problem description and help us to provide you some advice/solution.

theodore gravatar imagetheodore ( 2015-02-17 17:30:10 -0600 )edit

Sure thing, added the photo :)

topShelf gravatar imagetopShelf ( 2015-02-17 21:49:00 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-02-18 04:09:33 -0600

theodore gravatar image

updated 2015-02-18 04:10:55 -0600

If all of your images are like this, but just rotated and with different angle, then I would go for colour segmentation. Your black cross is quite big, hence it would be easily detectable. Moreover, when I have extracted the BLOB of the cross I would fit a bounding box over the contour of it. Having the bounding box, you have your ROI and job done. Your idea about the high pass filter was fine, however in the cases of rotated/with angle pictures that as you correctly guessed would easily fail.

edit flag offensive delete link more

Comments

I thnk you're correct. I was overcomplicating things - why make it any harder than it needs to be right?

topShelf gravatar imagetopShelf ( 2015-02-22 18:11:41 -0600 )edit

yup exactly ;-)

theodore gravatar imagetheodore ( 2015-02-22 18:29:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-17 00:29:48 -0600

Seen: 573 times

Last updated: Feb 18 '15