Ask Your Question

Jean-François Côté's profile - activity

2020-06-11 16:29:51 -0500 received badge  Popular Question (source)
2018-11-22 04:51:15 -0500 received badge  Notable Question (source)
2017-06-02 13:47:26 -0500 received badge  Notable Question (source)
2016-06-29 05:28:22 -0500 received badge  Popular Question (source)
2016-05-22 06:09:41 -0500 received badge  Popular Question (source)
2015-04-10 15:55:38 -0500 received badge  Popular Question (source)
2014-12-09 13:47:42 -0500 marked best answer What is the difference between traincascade and other feature detector?


We have a project that needs to detect animals on pictures. We started with rats and we are using trainscascade for this. Since we are not experiencing any luck with this method, I started looking in openCV documentation and found other method like template, SURF, etc...

Are these method also good for detecting complex things like animals (for example, rats?). Do you have any experience with them and could tell me the good and bad of each? Also, let me know if I'm wrong but the traincascade use the XML that we train ourselve (via the apps given by opencv) but how to we train the other type of feature detector?

Sorry if this question is dumb, I just want to learn :)

2013-12-10 12:59:34 -0500 marked best answer opencv_createsamples.exe entry point problem with XP

Hello everyone,

I'm currently on a project about pattern detection in video so we are curently using traincascade to get a Cascade classifier XML file. The project started on my computer (Windows 7 64 bits) so I compiled openCV using CMake with the WITH_TBB option set to true. I compiled everything in 32 bits (x86)

Works very well and used the apps very often with a lot of configuration without problem.

Then, another collegue gets into the project so I copied my whole directory of work with already compiled stuff(.exe of the opencv apps, dll, positive samples, etc) on his computer which is Windows XP 32 bits.

opencv_Traincascade.exe works very well on his computer but everytime he start opencv_createsmaples.exe with any parameters, he get this message:

The procedure entry point InitializeCriticalSectionEx could not be located in the dynamic link library KERNEL32.dll.

Does anyone has any idea what is causing that? Is there a configuration when I compile in Visual Studio 2010 that could fix this problem in XP? Or in the CMake? Do I need to recompile the .exe on each different machine that use it? (that would be insane!).


I just compile OpenCV (2.4.3) on the Windows XP machine with TBB using Visual Studio 2010. Everything compile perfectly except that when we run the opencv_createsamples.exe, the same error occurs (see above). It only happens in Release mode, if we compile in debug, it works! So I'm starting to think that maybe it's a bug in the latest release. Is there some developer over here that can check this out? Since the error is only happening in debug, I can't debug the code to see where it fail and I don't know the code enough to know where critical section are use. Also, like I said before, the opencv_traincascade.exe is working perfectly. Any idea?


After compiling without TBB and discovering that everything is working, we decided to validate if the problem is the TBB.dll itself or the usage of TBB by OpenCV. We just checked TBB.dll and TBB_debug.dll with "Dependancy Walker" and they are ok on their own (nothing in red, no call to InitializeCriticalSectionEx.dll). Seems the problem is the use of TBB by OpenCV. Here is the image of the "Dependency Walker" on the opencv_createsamplesd.exe (debug) and the opencv_createsample.exe (release) when compiled WITH_TBB in CMake. Hope it helps!

In debug, everything is ok Depends in debug

In release, problem! Depends in release


2013-10-28 10:21:15 -0500 marked best answer Very simple TrainCascade not working

Hello everyone,

I'm currently trying to detect complex thing in video but since it wasn't working at all, I've decided to go back to the basics and I'm trying to find this object

image description

So I used this script in a .bat file with a directory full of 1519 negative image that I checked one by one to contain nothing that look like that.

:: Creaction of 10000 positive variation of the image
opencv_createsamples -vec pos.vec -img positive/recherche.bmp -bg negative.txt -num 10000

:: Training
opencv_traincascade -data resultat -vec pos.vec -featureType LBP -bg negative.txt -numPos 1 -numNeg 1519

After that I'm searching in image like this:

image description

No luck at all... So imagine if the traincascade is not able to detect something as simple as this logo in a white bmp, I will never work on a real world example.

Anyone here could tell me what I'm doing wrong or what I could do to improve my technique. The correct answer will be awarded to the one that will give me an advice that will make this simple detection works. I've also read that Haartraining is slower, not developed anymore but could be more effective, is it true?


2013-09-23 10:04:13 -0500 commented question Is anyone responsible for the OpenCV NuGet package?

I will give it a try! Nice :)

2013-09-18 08:59:04 -0500 commented question Is anyone responsible for the OpenCV NuGet package?

Very interesting. I didn't know OpenCV could be use with C#. In fact, I'm using EmguCV for a year because it was the only interesting wrapper at that moment. Is there something made officialy by the openCV group?

2013-08-27 07:41:09 -0500 received badge  Teacher (source)
2013-08-26 06:43:35 -0500 answered a question Symbol detection/classification

What you need are 2 things

  1. Find a good descriptor
  2. Find a good classifier

If you can code in C#, I would highly suggest using the Accord.NET Framework since it will have everything you need out of the box. You can easily get something that works juste using the samples that come with the framework. For example, one of the example is able to classify numbers and another one classify the images of different animals.

For the descriptor, there are also a lot of them but since you are in black in white, maybe just give the array of black and white pixel and put that in a KSVM should to the magic.

Hope it helps!

BTW, you can all do these thing in OpenCV but it will need more work!

2013-08-26 06:36:04 -0500 commented question How to use CvMoments?

This question is not precise enough.

2013-08-26 06:25:02 -0500 commented question building photoshop-style black-white-conversion

What OpenCV algorithm are you using? BinaryThreshold? Filter? What have you tried so far?

2013-08-26 06:06:06 -0500 answered a question Should I blur the template used in matchTemplate()?

My understanding of the matchTemplate is that it's a very basic algorithm. It will move your template all over the image to find the best match. If you find a match that is over the specified threshold, it will return the position. If you blur the template, it will search for this blured template. Maybe it can help in your case but if your image is nice and clear, forget that.

By the way, if you are looking to find parts of face, there are already a ton of tools to do that in openCV. You should use the XML that have been trained with traincascade.exe and that are given with openCV code. The last time I checked, they can find nose, eyes, mouth, etc...

Hope it helps!

2013-08-26 05:48:12 -0500 commented answer C# official bindings roadmap

Yeah, EmguCV definitly need new blood in the development process but right now the current version is very stable and I know he's working on a new version.

2013-08-22 14:24:08 -0500 commented answer C# official bindings roadmap

Just want to add that I use EmguCV at work and the Library is very well done and things that need like 15 LOC in normal OpenCV can take 2 or 3 LOC. Unfortunately, some very low level task with pointers can't be made that easy. The licensing is only 400$ for a commercial application which is close to nothing if you are planning to sell your stuff. If it's for anything else, it's free. I would highly suggest EmguCV for anyone used to .NET and who want to use the power of OpenCV without the headache of C or C++. I agree that an automatic wrapper would be great, but even if it's done, wrapper like EmguCV will still have their place because the Library is written for .NET coders.

2013-08-12 11:16:32 -0500 received badge  Good Question (source)
2013-06-10 08:48:24 -0500 commented answer How to detect crescent shape?

I have used RANSAC for line fitting with some good results. Thanks for the help!

2013-05-30 07:18:27 -0500 commented answer How to detect crescent shape?

thanks, very interesting. I will play with that and let you know.

2013-05-29 14:10:14 -0500 commented question How to detect crescent shape?

Hi Howard. Thanks for the observation. Could you write an answer and go deeper into the explanation about the detection of the 2 edges and how to do a 2D polynomial curve?

2013-05-29 14:07:24 -0500 commented answer How to detect crescent shape?

Hi! Thanks for the answer but like I said in my EDIT, I already know how to manipulate my image to get an almost clear crescent. My problem is how to identify this shape as a crescent.

2013-05-28 08:39:05 -0500 asked a question How to detect crescent shape?


How can I detect a crescent shape? I have a binary image where the crescent is in white and the rest is black. There could be some noise and other shape in the image too. I tried with Hough circle but since it's not a complete circle, it detect other circle from the noise instead of the one in the crescent.

I was thinking about using shape comparison with contour but since a crescent is a complex polygon, I'm not sure it will work.

Here is an example: image description

Any ideas on how to approach this problem?


I know how to dilate and erode the image above to get a cleaner image. What I'm interested in is how to detect that it's a crescent.

2013-05-17 09:56:09 -0500 answered a question how to display an image at 120hz

First, do you need to show the SAME image multiple time at 120hz? If so, just show it one time and if you graphic card and monitor support 120hz, it will be refreshed like anything on your screen at 120hz...

If you talk about showing a video at 120hz, I don't know how to do that. You could try to play it faster by playing 120 frame per seconds but it will look like fast-forward... And anyway, most of users has screen of 60hz so they will never see 50% of your images...

Can you provide more information about what you are trying to achieve? I'll edit my answer if you give more information.

2013-04-03 14:20:51 -0500 received badge  Nice Question (source)
2013-03-28 08:49:15 -0500 commented answer opencv_createsamples.exe entry point problem with XP

You are right. I have found this while working with EmguCV developper. Since it's shipped with TBB, it will need to create a separate setup for windows XP support with TBB 4.0 instead of TBB 4.1

2013-02-12 07:48:35 -0500 asked a question DCT Transformation giving strange result using OpenCV

This is a copy of my question on stackoverflow because I didn't have an answer and maybe there are more people here that feel comfortable talking about DCT Transformation. Here is the question:

I'm trying to implement the Color Layout Descriptor in C# using an OpenCV wrapper.

All steps of my algorithm are unit tested but the step where I need to use DCT transformation is giving strange results. My 8X8 matrix is in float 32 (value between 0 and 1) but when I call the DCT, the result is giving some negative values and some values over 1.... I don't understand.

My understanding of the DCT Transformation was that it was used for compression and that it put the more common value in the top left corner but right now, these value just doesn't exist in the initial matrix.

Here is the initial matrix of size 8x8. Number has been rounded to help the reader.


Here is the matrix after the DCT


And here is the code. YMat is a one channel IPL_DEPTH_32F representing the Y channel and it is the initial matrix. YMatDCT is the resulting matrix.

cvlib.cvDCT(YMat, YMatDCT, cvlib.CV_DXT_FORWARD);

Maybe this is the normal behavior of the DCT transform but if it is, can somebody explain me how to use it because I expected the value to be between 0 and 1.


2013-02-11 10:43:47 -0500 commented answer How to find the two most dominant colors in an image?

It would be very interesting to have some sample code for the approach that you suggest @SR. I understand the idea but I'm strugeling with the code itself (with the k-means function in fact!)

2013-02-01 13:09:27 -0500 commented question Build OpenCV without Android

did you read this?

2013-02-01 10:31:42 -0500 commented answer Implement a hough for thick lines

Very nice approach Guanta!

2013-01-30 14:03:54 -0500 commented question Implement a hough for thick lines

The basic function doesn't detect your line? Do you have an example of image?

2013-01-30 10:19:40 -0500 commented question Image Stitching with OpenCV

Please mark the answer that you think help you the most as the answer by checking the checkbox on the left of that answer. Thanks!

2013-01-29 08:55:43 -0500 answered a question Image Stitching with OpenCV

It sure can! If fact, it's one of the basic function from openCV. Check the documentation here

2013-01-29 08:53:18 -0500 answered a question Is Haar training ok for detecting objects like scissors?

I'm also currently working on a project to detect various kind of things. If you are willing to invest time in tweaking the training process and get a lot of positive and negative image, yes it's a good technique. Don't forget that it detect object in a "almost fix position". For example, the face detector don't detect face that are not align perfectly with the webcam. So if you want to detect scissors in various angle, you will need to create at least classifier (xml) for at least the angles that will mostly be visible from the camera.

I'm not aware of any "out of the box" detection technique for scissors but you can always use your imagination and use some picture manipulation to extract a contour and recognise de shape or maybe some background suppression if the camera is not moving.

Have fun!

2013-01-29 01:10:19 -0500 received badge  Student (source)
2013-01-28 09:02:57 -0500 asked a question Up to date version of Mergevec.cpp?


I'm currently doing some traincascade experiment. For some object I want to find, I don't have more dans ~100 positive samples. I would like to use the technique explain in this very good but very old tutorial.

The part with the perl script to generate the multiple .vec file work well (with some modifications) and I create all the .vec. Now, I'm stuck at the part where I need to merge the .vec file...

They give the code but it's in opencv 1.0.0 so it's kind of outdated. Is there a version that somebody updated to work with OpenCV 2.4.3? (By the way, I think this code should be integrated in the OpenCV trunk and maintained). I would like something simple like copy the .cpp somewhere in the OpenCV project, compile and it work. Honestly, I just doesn't understand the code in the .cpp to make it work myself.

Any help would be greatly appreciated! Thanks