5

scene

Suppose I have an image of a scene as depicted above. A sort of a pole with a blob on it next to possibly similar objects with no blobs. How can I find the blob marked by the red circle (a binary image indicating which pixels belong to the blob).

Note that the pole together with the blob may be rotated arbitrarily and also size may vary.

Leo
  • 1,213
  • 2
  • 13
  • 26
  • if those two are the only figures that can appear in the image then it is a search thru the pixel array for curved borders. You have enough to calculate the center of the circle the moment you found such a border. – ashley Nov 27 '12 at 20:42
  • and how might one achieve this? – Leo Nov 27 '12 at 21:03

4 Answers4

1

One approach could be using Viola-Jones object detection framework.

Though the framework is mostly used for face detection - it is actually designed for generic objects you feed to the algorithm.


The algorithm basic idea is to feed samples of "good object" (what you are looking for) and "bad objects" to a machine learning algorithm - which generates patterns from the images as its features.

During Classification - using a sliding window the algorithm will search for a "match" to the object (the classifier returned a positive answer).


The algorithm uses supervised learning and thus requires a labeled set of examples (both positive and negative ones)

amit
  • 175,853
  • 27
  • 231
  • 333
  • Thanks, but I'd rather a simpler solution. This is somewhat computationally intensive (despite being realtime) . Plus, I really have a good prior of what the "blob" looks like so preparing a labeled set seems a bit unnecessary. I was hoping to find something like an iterative geometry matching technique. – Leo Nov 27 '12 at 20:59
1

Can you try to do it in below 4 steps?

  1. Circle detection like: writing robust (color and size invariant) circle detection with opencv (based on Hough transform or other features)
  2. Line detection, like: Finding location of rectangles in an image with OpenCV
  3. Identify rectangle position by combining neighboring lines (For each line segment you have the start and end point position, you also know the direction of each line segment. So that you can figure out if two connecting line segments (whose endpoints are close) are orthogonal. Your goal is to find 3 such segments for each rectangle.)

  4. Check the relative position of each circle and rectangle to see if any pair can form the knob shape.

Community
  • 1
  • 1
greeness
  • 15,956
  • 5
  • 50
  • 80
0

I'm sure there is some boundary-map algorithm in image processing to do this.

Otherwise, here is a quick fix: pick a pixel at the center of the "undiscovered zone", which initially is the whole image. trace the horizantal and vertical lines at 4 directions each ending at the borders of the zone and find the value changes from 0 to 1 or the vice verse.

Trace each such value switch and complete the boundary of each figure (Step-A). Do the same for the zones that still are undiscovered: start at some center point and skim thru the lines connecting the center to the image border or to a pixel at the boundary of a known zone.

In Step-A, you can also check to see whether the boundary you traced is a line or a curve. Whenever it is a curve, you need only two points on it-- points at some distance from one another for the accuracy of the calculation.

The lines perpendicular each to these two points of tangency intersect at the center of the circle red in your figure.

ashley
  • 1,177
  • 1
  • 14
  • 17
0

You can segment the image. Then use only the pixels in the segments to contribute to a Hough-transform to find the circles. Then you will only have segments with circle in them. You can use a modified hough transform to find rectangles. The 'best' rectangle and square combination will then be your match. This is very computationally intentsive.

Another approach, if you already have these binary pictures, is to transform to a (for example 256 bin) sample by taking the distance to the centroid compared to the distance travelled along the edge. If you start at the point furthest away from the centroid you have a fairly rotational robust featurevector.

Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121