1、OpenCV to detect how missing tooth in equipment
Hello everyone. I am just starting with OpenCV and still a bit lost.
Is OpenCV helpful to detect the position of a missing object (tooth for example)?
I would like to build a code to analyze an image of an equipment and detect which tooth is missing and its position.
For example in the image attached below of an equipment that has 9 teeth normally: the code should show a message that the 2nd tooth is missing.
Is this possible with OpenCV? If yes, where do I start?
Attached you will find the figure.
2、Detect equipment in desired position
Is It possible to evaluate some pictures and save them Just when the object is in some desired position?
For example: monitoring a vídeo of an equipment that moves in and out of the scene. I would like to detect the time when the equipment is fully in the scene and then save It in a desired folder.
Thanks a Lot and have a great weekend
3、Does findContours create duplicates
Hi,I'm considering a binary image from which I extract its edges using cv::Canny. Consequently, I perform cv::findContours, storing all the contours points coordinates in a
vector < vector < Point > >
I noticed that the number of pixels (Points) in this structure is greater than the number of pixels I get by computing
on the same image.
Therefore I'm wondering if this happens because findContours includes duplicate points in its result or because findNonZero is less precise.
E.g. on a 200x200 sample image with the first method I get 1552 points while with the second I get 877.
In case the first hypothesis is correct, is there a way to either ignore the duplicates or remove them?
In case of a Canny edge image findContours will find most of the contour points twice, because the line width is only 1 and findContours is looking for closed contours.
To remove duplicates you can map the contour points to an empty (zero) image.For every contour point add 1 at the image position and only copy the contour point to your new contour vector if the value at this position is zero. That would be the easiest way I think.
6、Is findContours fast enough ?
For current vision algorithms (e.g. object detection, object enhancing) does findCountours perform fast enough ? I've studied the algorithm behind it  and by a first look it's rather difficult to perform in parallel especially on SIMD units like GPUs. I took a usage example from  and did a simple trace of findCountours on  and . While  requires 1ms,  requires about 40ms (AMD 5400K @3.6ghz). If high resolution video processing frame by frame is considered these results could be problematic. I think i may have an ideea for a faster algorithm oriented towards SIMD units. So i would like some feedback from people who have worked in vision problems to the question:
Is findCountours fast enough for current problems on current hardware ? Would improving it help in a significant way any specific algorithm ?
Thank you in advance,Grigor
 http://tpf-robotica.googlecode.com/svn-history/r397/trunk/Vision/papers/SA-CVGIP.PDF http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html http://jerome.berbiqui.org/eusipco2005/lena.png http://www.lordkilgore.com/wordpress/wp-content/uploads/2010/12/big-maze.png非常专业的提问，commit也非常有趣，注意下一行标红的部分，是object detection的state of art的方法。
Like @LBerger linked (but I do not really like links only responses) you should apply the following pipeline.
- Binarize your image, using for example OTSU thresholding
- Apply the distance transform to find the centers of all disk regions
- Use those to apply a watershed segmentation
It will give you a result, like described in the tutorial and should look something like this:
8、Can I resize a contour?
I have an application that detects an object by finding its contour. Because the image where I search for the object may be at a very big scale is affecting my detection because the contour can be too long and I skip the contours longer than a threshold. For fixing this, I have thought of resizing the image larger than a maximum size to that maw size. Doing so, I am detecting the object in the smaller image, and when drawing the contour on the initial image, I am getting a "wrong detection". Is there a possibility to resize the contour?很有趣的思路，一般来说我会首先缩放图片，然后再去寻找新的contour，它这里所做的可能是为了满足特定需要的。
Nice, it is working, and it is working very nice. More, your idea of resizing the mask is introducing errors, because the
cv::fillPoly is introducing errors (small "stairs") and resizing it is just making the errors to appear in the new contour, and they are even bigger.
In the sample below, the green contour is main contour and the red contour is scaled contour with a coefficient of 0.95.