Image processing - Match curves from one image to another

前端 未结 1 1203
南方客
南方客 2021-02-04 18:40

I am doing something similar to this problem: Matching a curve pattern to the edges of an image

Basically, I have the same curve in two images, but with some affine tra

1条回答
  •  孤城傲影
    2021-02-04 19:07

    I think some sort of keypoint matching algorithm like sift or surf would work with this kind of data as well. The basic idea would be to find a limited number of "interesting" keypoints in each image, then match these keypoints pairwise.

    Here is a quick test of your image with an online ASIFT demo: http://demo.ipol.im/demo/my_affine_sift/result?key=BF9F4E4E006AB5168497709836C39C74#

    enter image description here

    It is probably more suited for normal greyscale images, but nevertheless it seems to work for this data. It looks like the lines connect roughly the same points around both of the curves; plugging all these pairs into something like the FindHomography function in OpenCv, the small discrepancies should even themselves out and you get the affine transformation matrix between the two images.

    For your particular data you might be able to come up with better keypoint descriptors; perhaps something to detect the line ends, line crossings and sharp corners.

    Or how about this: It is a little more work, but if you can vectorize your paths into a bezier or b-spline, you can get some natural keypoints from the spline descriptors.
    I do not know any vectorisation library, but Inkscape has a basic implementation with which you could test the approach. Once you have a small set of descriptors instead of a large 2d bitmap, you only need to match these descriptors between the two images, as per FindHomography.


    answer to comment:

    The points of interest are merely small areas that have certain properties. So the center of those areas might be black or white; the algorithm does not specifically look for white pixels or large-scale shapes such as the curve. What matter is that the lines connect roughly the same points on both curves, at least at first glance.

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