Image/Rectangle matching

Hi
I have a two image in which there is a fixed size rectangle on base image and I wanted to compare that rectangle with second scanned image.
I don’t know the position of rectangle in second image it might be skewd, scale or even tiled.
Does matlab has any function to compare rectangles and automatically scaled or deskew the second rectangle based on reference rectangle?
please help me out thanking you;

 採用された回答

David Young
David Young 2011 年 6 月 14 日

0 投票

The question boils down to: "How can I find a rectangle in an image?" Once you have found the coordinates of the corners of the rectangles in the images, it is easy to find the transformation that maps one to the other, and apply it to one of the images.
How hard finding the rectangle is depends on what else is present in the image. It's hard to advise without knowing this. However, one approach worth exploring might be to use the Hough transform to find straight lines, and look for groups of these that satisfy some geometric conditions. The Hough transform is available in the Image Processing Toolbox.

5 件のコメント

Dipak
Dipak 2011 年 6 月 14 日
Hi David Thanks for immediate reply.
this is what my question is I have a reference image on which the position and size of rectangle on image is fixed and I wanted to find out the same rectangle on second scanned image. The second image might not be perfect scanned so there may be a possibility to deskew or scaling of the rectangles.
I wanted to find out the rectangle from second image and scale/deskew exactly same as first one.
David Young
David Young 2011 年 6 月 14 日
Hi Dipak. Do you mean that the rectangle is defined by some coordinates, but not by lines in the image? If that's the case, you may be able to use the image-matching technique from the file exchange contribution to find the size and scale change: http://www.mathworks.com/matlabcentral/fileexchange/27093-affine-optic-flow
Dipak
Dipak 2011 年 6 月 14 日
Hi David For your Reference I am sendinng you both the base and target images have look on this and provide solution if you can
This is the base image
http://postimage.org/image/1fd36rj7o/
this is the target image
http://postimage.org/image/1fc640lc4/
I wanted to compare both the image. and find out the bubble marks.
Thanking you.
David Young
David Young 2011 年 6 月 15 日
Thanks - it's easier to understand the problem now. I see that the rectangles are clearly visible.
My recent suggestion in a comment above, of using affine optic flow matching, is not a good idea - you can forget that one.
My original proposal, to use edge detection followed by the Hough transform, followed by finding the intersections of the most prominent lines, might work. Once you've found the rectangle corners in the two images, you can use maketform and imtransform to align the images.
However, as the rectangles are very dark and have thick boundaries, it might be simpler to find them by thresholding, and then using regionprops to (a) find the largest region and (b) find its extrema. It may even be that the extrema of the region will give you adequate corner coordinates. I would try this approach first, before going to the Hough transform, as it is simpler.
Dipak
Dipak 2011 年 6 月 17 日
Hi David Thank you
I am doing the same way as u suggest right now m working on that let you know if I face any issue thank you for suggestion david.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by