01-12-2010 10:56 AM
01-12-2010 11:45 AM
It is possible, but the approach will be different depending on the rotation speed. What are the min and max rotation speeds expected?
Is the square in the center of rotation, or does it rotate around the center of rotation? Will it always be in the same location? Are there other marks or features on the piece that could be used to figure out orientation? What is the general shape of the piece?
Do you have any pictures? Those always help.
Bruce
01-12-2010 11:57 PM
01-13-2010 02:48 AM
Hi! Thank you for your answers. You can find enclosed to this message an image describing the system.
The motor axis (and of course the mechanical piece) can rotate from 0 to 10 rot/sec.
As you can see on the picture, the square rotates around the center of rotation and will always be in the same location. Another mark that can help figuring out the oriantion of the piece is an engraved letter "N".
Would it be a good idea to determine how many times per second the "N" becomes a "Z" ?
01-13-2010 03:14 AM
01-13-2010 03:24 AM - edited 01-13-2010 03:24 AM
01-13-2010 03:27 AM
01-13-2010 03:30 AM
You can also use a clamp (edge detection). The clamp width(any direction) will change once the rotation takes place. And n becoming a z will only means a 180 deg....
The better thing will be to get a avi output and clamp the result.
just My thought.....
01-13-2010 03:31 AM
Ok, I'll try this first solution and give you a feedback as soon as possible...
If you have any other idea, don't hesitate to share them 
01-13-2010 10:18 AM
Here is what I would probably do:
Train a pattern for the N. You might want to try standard pattern matching or geometric pattern matching and see which one works better.
For each image coming in, use pattern matching to locate the N. Make sure you allow full rotation. Once you determine the center of rotation, you should be able to measure the angle between the N and the center of rotation. Each frame should give you a delta angle from the previous frame. The formula for instantaneous speed will be: (delta/360 deg)*frame rate = rotations per second. This won't be a really smooth value, but it should be very close to true speed. You could filter it if you want a more average speed.
Bruce