# Thread: Identify pixel in the image.

1. Member
Join Date
Nov 2009
Posts
3
Rep Power
0

## Identify pixel in the image.

I'm sorry my bad English. But I am Brazilian and I'm not accustomed to English.
I have the following problem:
I'm trying to identify a point (pixel) in an image.
The problem is the following:
Among some dashed lines need to identify where they intersect, or combine. The thickness of the line is 1 pixel. So by logic, where 1 pixel, find 3 neighboring pixels (connected) would be a point to identify. I need to do this to change the value of this pixel and its neighbors. The image is in grayscale. Black lines with
background.
Only those pixels that are neighbors are direct (online) (vertical, horizontal) and Diagonal.
How could I do the reading of the image and find these points?
I am using the class "raster" for reading.
I do not know if I can do this by reading the linear rows and columns. Or if I use a neighborhood algorithm.
How can I solve this problem?
It has an example of an image: (link)

Thank you all!

2. This is a hard problem, but very doable.

Your first step is to decide what is a colored pixel. You will need to figure out the threshold of gray is considered a pixel: is it 90% black or 50% or some other percent black. It would be like:

Java Code:
`public boolean isPixelBlack(int[] color) {...}`

-or-

Java Code:
`public boolean isPixelBlack(int indexedColor) {...}`

With that threshold method you can then loop through the image pixel array using the raster or a PixelGrabber and build a 2d boolean array and use it with your neighborhood algorithm.
Last edited by mrmatt1111; 11-11-2009 at 09:54 PM.

3. Member
Join Date
Nov 2009
Posts
3
Rep Power
0

## Neighborhood algorithm?

Thanks for the help mrmatt1111. But the fact is that the logic to find the pixels I know how. The problem is the algorithm of the neighborhood. That I do not know how. A given pixel would be easy to find.
It would be 90% black, or greater, it is a point. Just do not know how the logic of the algorithm neighborhood. This one is my big question.
Any ideas?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•