How to detect curves in a binary image?

后端 未结 5 1879
囚心锁ツ
囚心锁ツ 2021-02-05 11:39

I have a binary image, i want to detect/trace curves in that image. I don\'t know any thing (coordinates, angle etc). Can any one guide me how should i start? suppose i have thi

相关标签:
5条回答
  • 2021-02-05 11:46

    It really depends on what you mean by "curve".

    If you want to simply identify each discrete collection of pixels as a "curve", you could use a connected-components algorithm. Each component would correspond to a collection of pixels. You could then apply some test to determine linearity or some other feature of the component.

    If you're looking for straight lines, circular curves, or any other parametric curve you could use the Hough transform to detect the elements from the image.

    The best approach is really going to depend on which curves you're looking for, and what information you need about the curves.

    reference links:

    • Circular Hough Transform Demo
    • A Brief Description of the Application of the Hough Transform for Detecting Circles in Computer Images
    • A method for detection of circular arcs based on the Hough transform
    • Google goodness
    0 讨论(0)
  • 2021-02-05 11:46

    1) Read a book on Image Analysis

    2) Scan for a black pixel, when found look for neighbouring pixels that are also black, store their location then make them white. This gets the points in one object and removes it from the image. Just keep repeating this till there are no remaining black pixels.

    If you want to separate the curves from the straight lines try line fitting and then getting the coefficient of correlation. Similar algorithms are available for curves and the correlation tells you the closeness of the point to the idealised shape.

    0 讨论(0)
  • 2021-02-05 11:53

    Im no computer vision expert, but i think that you could detect lines/curves in binary images relatively easy using some basic edge-detection algorithms (e.g. sobel filter).

    0 讨论(0)
  • 2021-02-05 11:57

    Since you already seem to have a good binary image, it might be easiest to just separate the different connected components of the image and then calculate their parameters.

    First, you can do the separation by scanning through the image, and when you encounter a black pixel you can apply a standard flood-fill algorithm to find out all the pixels in your shape. If you have matlab image toolbox, you can find use bwconncomp and bwselect procedures for this. If your shapes are not fully connected, you might apply a morphological closing operation to your image to connect the shapes.

    After you have segmented out the different shapes, you can filter out the curves by testing how much they deviate from a line. You can do this simply by picking up the endpoints of the curve, and calculating how far the other points are from the line defined by the endpoints. If this value exceeds some maximum, you have a curve instead of a line.

    Another approach would be to measure the ratio of the distance of the endpoints and length of the object. This ratio would be near 1 for lines and larger for curves and wiggly shapes.

    If your images have angles, which you wish to separate from curves, you might inspect the directional gradient of your curves. Segment the shape, pick set of equidistant points from it and for each point, calculate the angle to the previous point and to the next point. If the difference of the angle is too high, you do not have a smooth curve, but some angled shape.

    Possible difficulties in implementation include thick lines, which you can solve by skeleton transformation. For matlab implementation of skeleton and finding curve endpoints, see matlab image processing toolkit documentation

    0 讨论(0)
  • 2021-02-05 12:05

    There is also another solution possible with the use of chain codes. Understanding Freeman chain codes for OCR

    The chain code basically assigns a value between 1-8(or 0 to 7) for each pixel saying at which pixel location in a 8-connected neighbourhood does your connected predecessor lie. Thus like mention in Hackworths suggestions one performs connected component labeling and then calculates the chain codes for each component curve. Look at the distribution and the gradient of the chain codes, one can distinguish easily between lines and curves. The problem with the method though is when we have osciallating curves, in which case the gradient is less useful and one depends on the clustering of the chain codes!

    0 讨论(0)
提交回复
热议问题