|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
tracing a line in a bitmap?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 Hello Lars,
If you can identify the corners it should be trivial from there. -Boo Show quoteHide quote > 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 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 Show quoteHide quote "GhostInAK" <ghosti***@gmail.com> wrote in message news:c71747b4303018c8a7a13e5e37d0@news.microsoft.com... > 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 > > 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
can a method implement an interface and handle an event at the same time?
how to rollback a procedure (sqlserver) from VB2005? determining end of file FileSystemWatcher across the network (newbie VB 2005 EE ) composing string from variables how to make base and derived class use the same member variable? Key Required for .Update with mdb file ? Assuming True Deserializing object Subtract Days from a Date How to licensce a .NET desktop application |
|||||||||||||||||||||||