Removing narrow blobs from an image...please help!

A

almurph

Hi,


I need to write something in Java that can remove long narrow blobs
in an image - say for a black blobs on a mainly white image. Problem
is though - I don't know how to do it. Can you help me please?

Here is what I have so far. I would greatly appreciate any suggestions/
comments/code-samples that you may be able to offer.

Cheers,
Colm


***** CODE AS FOLLOWS ******


// Remove long narrow blobs from an image. Not nice round
blobs - just long thin ones.
private static ImageProcessor RemoveLongNarrowBlobs
(ImageProcessor inputImage, int someVariables)
{
// 1. Make a copy of the original image - this is where the
new image will go
ImageProcessor outputImage = new ShortProcessor
(inputImage.getWidth(), inputImage.getHeight());
outputImage = outputImage.convertToRGB();

// 2. Member variables
int origPixel;
int pixAfterWhiteMap;


// 3. Cycle through the dimentsion of the original image
and do the business
for (int i = 0; i < inputImage.getWidth(); i++)
{
for (int j = 0; j < inputImage.getHeight(); j++)
{
// For each pixel get a white map
origPixel = inputImage.get(i,j);
pixAfterWhiteMap = origPixel & 0xFFFFFF; //white

if(pixAfterWhiteMap > 0) //not black
{


}


}//j
}//i



return outputImage;

}
 
L

Lew

I need to write something in Java that can remove long narrow blobs
in an image - say for a black blobs on a mainly white image. Problem
is though - I don't know how to do it. Can you help me please?

Please do not multi-post. John B. Matthews answered your question in
clj.help, but due to the multi-post (instead of cross-post) his answer is not
visible in clj.programmer. Those with newsreaders set to ignore duplication
via cross-post are confounded by multi-posts.

Usually it suffices to post to one Java group, but if more are needed then add
them to the destination for the *same* message; don't independently post
copies to different groups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top