MATLAB Answers

0

How can I identify a particular shape at all degrees, while ignoring the rest?

Asked by Kimo Kalip on 13 Jun 2018 at 22:49
Latest activity Commented on by Kimo Kalip on 20 Jun 2018 at 21:12

Hello, I have an image of various lines and blobs, and I want my image to only show the lines. To accomplish this, I have utilized watershed, regionprops, ismember, and a few other methods in order to get to the image I am now. At this point, I can't reduce the area boundries, as I'll start losing lines before I lose the blobs, and solidity wouldn't accomplish anything as all of the shapes appear to have the same solidity (probably due to how the shapes were generated.) What options do I have left? Thanks in advance!

  2 Comments

You could try to use SURF features, but if the object you want to identify is the long line-wise one then you will have a really hard time.

Yeah, I have thousands of those longer lines at various angles (So unfortunately there is no uniform orientation). The idea is to reduce the image to the point where only those white lines remain, and all extraneous noise is weeded out - but I'm wondering if I've hit a wall. Thanks for the idea though!

Sign in to comment.

2 Answers

Answer by Image Analyst
on 14 Jun 2018 at 11:45
 Accepted Answer

Try the ratio of the majoraxislength to minoraxisLength.

  12 Comments

So I have successfully filtered out large unwanted aspect ratios from my image, but in this variant I have several that have an aspect ratio of around 1. The problem is, this little pixel I'm zoomed in here also has a aspect ratio of 1 (I think, having a hard time verifying, but I think its a reasonable assumption).

Is there a way to get bwconncomp() to have a minimum and maximum "object" size before you run it? The way I've been doing it so far is filtering out the image prior, but if there is a way to teach the program what is and isn't a reasonable and regular size, it may be easier.

You can use bwareafilt() if you want instead.

Alright, so I feel like I'm really close, but still not quite there. I may be masking in the wrong place, so that might be why I'm still not getting rid of these far off specs... When I attempted setting a minimum and maximum area, it only worked partially, and in some cases did damage as some of the things I'm identifying gets reduced to one pixel too, so I start losing them if I impose a minimum trying to get rid of these far off things. Should I attempt to impose a minimum and maximum distance between objects? The concern there would be added processing time... Unfortunately these black dots at the extremes here are the same shade as the black dots I'm supposed to be looking for, so: I can't filter on color, area, size, axis length, etc. As is, I am getting rid of the background, so as far as the program is concerned that gray outline and the white background don't exist, which is why I was thinking of some automated way to crop around the gray border before doing my later processing methods. In theory should I still be able to just mask everything in the gray border? The conceptual part I'm stuck on is that its inside rather than ontop of, and the background disappears pretty early on anyway...

Sign in to comment.


Answer by Image Analyst
on 18 Jun 2018 at 21:06

You might enjoy learning about Hu's moments: http://www.youtube.com/watch?v=Nc06tlZAv_Q

  1 Comment

Pretty close more or less to what I'm trying to achieve. Does he upload a reference photo for each logo at the start there though? In my case, the idea is that there are thousands of relatively similar shaped boxes rotated around a circle, the image is grayscale, and they usually the darkest thing on the image (Although not always, which is another thing I need to account for). What I'm getting at is: in many cases I won't have a reference to provide, other than the other objects in the image - does this still work? Also, the mms function he uses to determine the moments was something he wrote himself, and not provided by matlab? Thanks for the video though! End result was pretty cool

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today