Message Boards Message Boards

0
|
7060 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

DeleteSmallComponents

Folks have been so helpful, let me try another.

Shouldn't the following produce a blank page (all black or all white, depending on your parity preference):

tmp = Import["tmp.jpg"]; tmp = Binarize[tmp]; tmp = DeleteSmallComponents[tmp, 100000000];

I don't see any difference from not calling DeleteSmallComponents at all.

Thanks for any insight.

Cheers, Scott

POSTED BY: Scott Guthery
2 Replies

I'm assuming you are working with the images that were discussed in the context of the DeleteBorderComponents question. I'm not able to reproduce the problem you see. For example, using the attached binary image obtained via:

im = Import["jqa_v12_p01.jpg"]
binary = MorphologicalBinarize[ColorNegate[im]]

If I call DeleteSmallComponents with a small threshold, like 300, you can see that lots of the little speckle components are deleted.

DeleteSmallComponents[binary, 300];
ImageDifference[binary, %]

If I ramp the component size threshold way up, the result is a blank black image since every component is deleted.

DeleteSmallComponents[binary,10000000]

Does that help?

Attachments:
POSTED BY: Matthew Sottile

That's strange. I ran DeleteSmallComponents and then ImageAdjust on every example image built into Mathematica and it seems to always produce a Black image.

Does it work for you if you use this example image?

ExampleData[{"TestImage", "Mandrill"}]

If so, then I'd guess there's something special about your image.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract