By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

tracing a line in a bitmap?

P: n/a
Hi,

I have by reading thru the bytes of a bitmap and added an edge detection
filter, created an image with more distinct edges. From this I would like to
find a recangle shaped object. How can I determine where in the picture this
recangle shape is and how big it is?

best regards
/Lars
Sep 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello Lars,

If you can identify the corners it should be trivial from there.

-Boo
Hi,

I have by reading thru the bytes of a bitmap and added an edge
detection filter, created an image with more distinct edges. From this
I would like to find a recangle shaped object. How can I determine
where in the picture this recangle shape is and how big it is?

best regards
/Lars

Sep 16 '06 #2

P: n/a
Yes, that would be easy but what if I just want to find a line starting from
one pixel. I guess it would have to be some kind of convultion matrix thingy
but at the same time saving the coordinates?

/Lars

"GhostInAK" <gh*******@gmail.comwrote in message
news:c7**************************@news.microsoft.c om...
Hello Lars,

If you can identify the corners it should be trivial from there.

-Boo
>Hi,

I have by reading thru the bytes of a bitmap and added an edge
detection filter, created an image with more distinct edges. From this
I would like to find a recangle shaped object. How can I determine
where in the picture this recangle shape is and how big it is?

best regards
/Lars


Sep 18 '06 #3

P: n/a
I helped do this in graduate school a long time ago, so I don't have
any code for an example. But...........

There are edge detection algorithms that you can use to trace the
outline of an object. The algorithm we used was a recursive algorithm
that used the fact that the edge must trace in one of eight ways.
These correspond to the eight directions; ie. N, NE, E, SE, S, SW, W,
and NW.

So you first find an edge. Then you trace around the edge using the
recursive algoithm. This give you a map of the edge.

Then you calculate the first, second, and (if I remember right) third
moments of inertia of this edge map. Again, there are equations to do
this, but I don't have them handy anymore. You can determine shapes by
comparing the ratios of the various moments with the ratios of known
objects.

If you do all this correct, it will not matter if the rectangle is
aligned ordinally or not. That is, the rectangle does not have to be
north-south and east-west. It can be identified however it is placed
on the map.

The big problem was overlapping objects. A circle overlapping a
rectangle gives you an object with unknown moments.

Good luck,
Brian

Sep 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.