1
$\begingroup$

I am working on some image processing application using Matlab. The image after segmentation will look (more or less) like the figure below.

enter image description here

Now I want to find the four corners of each shape to crop it (I can access each using shape using its pixels as they have the same label after segmentation). I though of using a corner detector like harris, but it gives me many additional corners (as the sides of the shapes are not really straight due to discretization. for example, a straight line in an image will look like the image below, and hence will introduce many corners.

enter image description here

In even worse cases, due to the imperfection of the image segmentation, the corners may actually be lost and look like a curved line as shown below, even though the image before segmentation had these clear 4 corners.

enter image description here

Another approach that I thought of is first to crop each shape, and then to use the line information (using a line detection algorithm) of the 4 sides and find the intersection of each adjacent sides. However, the line information, again due to imperfect segmentation, may not exist (as a single straight line per side, a side could be detected as multiple non-connected lines). Moreover, again due to imperfect segmentation, the 4 sides may have some artifacts which will hinder proper line detection.

Any suggestions?

$\endgroup$
1
$\begingroup$

I though of using a corner detector like harris, but it gives me many additional corners (as the sides of the shapes are not really straight due to discretization.

In that case you should keep only the strongest feature points.

the corners may actually be lost and look like a curved line as shown below, even though the image before segmentation had these clear 4 corners.

In that case, you can use scale space, first blur the images excessively, then use Harris, or directly use SIFT detector and keep only the features points of the scale, that match your desired points.

$\endgroup$
  • $\begingroup$ I actually tried to use the strongest points, but the drawback of this approach is that you have a tunable parameter that if it works for one image it may not for the others. That is, I want the technique to be as general as possible but also with the least number of tunable parameters. $\endgroup$ – user84310 Apr 14 '17 at 0:24
  • 1
    $\begingroup$ You could tune the intensity of the blur to the size of the objects in your image. This can be automated if you have a reliable way of calculating the areas of the shapes in your images. $\endgroup$ – goldrik Dec 9 '17 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.