detect square objects in a binary image

4 次查看(过去 30 天)
i have previously used regionprops to measure the boundingbox in a binary image. but the thing is sometimes it can detect sometimes it cannot detect the square in the image. is there any more robust way to detect square and obtain its location and dimension?

回答(2 个)

Jeremy
Jeremy 2013-11-1
I was thinking about this recently, a hough transform could be a very robust way to find squares, if they are not rotated at all it would be fairly quick and would have no trouble with partial or overlapping squares. Are these actual squares or rectangles? I don't know your experience level, but writing a hough transform from scratch can be tough.
  2 个评论
genesis
genesis 2013-11-1
they are square exactly but maybe in different orientation i would say my experience is beginner

请先登录,再进行评论。


Image Analyst
Image Analyst 2013-11-1
I would not really say that regionprops is a square detector. It characterizes and measures blobs. You need to do something in advance to create a binary image. If you did a good job, then your blob will be square and regionprops will measure it, and all blobs and tell you which are square or not square, but you have to have created the cquare binary blobs in the first place. How you do that is through image processing and what processes you need to use depend on what your square looks like. is it solid, or a perimeter that's "hollow" in the middle? Have you tried the corner() function? It all depends on what your image looks like. An algorithm that's good at detecting a bright square on a black background would not be appropriate for detecting a blue satin fabric patch on a piece of blue knit fabric the same color. You might be able to get by with simple thresholding in the first case, while in the second case you'd need a texture processing method.

Community Treasure Hunt

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

Start Hunting!

Translated by