detecting of edge in an image
hi all,
I've just heard of JAI today, so I hope I've posted my problem into the right place...
so:
if I have an image containing a line:
How can I read it, and get:
line 1: (0, 3) (10, 3)
namely the line being represented with its start and end points.
thanks in advanced...
[325 byte] By [
Kenkena] at [2007-11-15]

you can place a Rectangle around the image.
If we had a 15 by 15 image at 100,200 then this would be the code...
Rectangle r = new Rectangle(100,200,15,15);
You can then test to see if the cursor is inside the rectangle by using the MouseMotionListener to update in x; int y; with the current position of the mouse and draw another rectangle called s.
There is a way to see if they are intersecting, so you can use something like this...if(r.intersects(s)) {
//Do your event code
}
> you can place a Rectangle around the image.
> If we had a 15 by 15 image at 100,200 then this would
> be the code...
> Rectangle r = new
> Rectangle(100,200,15,15);
> You can then test to see if the cursor is inside the
> rectangle by using the MouseMotionListener to update
> in x; int y; with the current position of the mouse
> and draw another rectangle called s.
>
> There is a way to see if they are intersecting, so
> you can use something like this...> if(r.intersects(s)) {
>//Do your event code
>
Thanks for your reply, but I think I didn't make my problem clear:
I actually want to detect all the lines(e.g. black) in an image, but this image can also contain other colors.
the pure detection is not enough, because I don't just want to get all the lines, but want to get their representation as start and end points
Then you need to do something called clustering.
Basically, you need to (in software) divide an image into 4 segments and keep subdividing those segments until you get individual pixels. Then all the pixels with the color you want can be isolated. I don't know how to do that.
You are taking on a serious programming challenge!
What do you need to do this for?
> Then you need to do something called clustering.
> Basically, you need to (in software) divide an image
> into 4 segments and keep subdividing those segments
> until you get individual pixels. Then all the pixels
> with the color you want can be isolated. I don't know
> how to do that.
>
> You are taking on a serious programming challenge!
> What do you need to do this for?
M... 've already felt that ;-)
it's actually a part of my part-time job, but it's an optional part. I just think it could be very interesting ;-P
isn't there already a function to get all the pixel values out of an image into an array, I thought there was...
if so, then I could detect all the lines using operators, but the problem is, how can I get their start and end points...
crying...
There is a function to get pixels from an array.
But I don't know how to use it.
are the lines in any angle or just vertical/horizontal?