kl3m3n's blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Human detection in LabVIEW using histogram of oriented gradients with OpenCV

Klemen
Active Participant

Hello,

i have prepared and tested an implementation of HOG for human detection in LabView using OpenCV. The program is a good starting point to develop your own application for human detection. Don't forget, you can also train your own HOG descriptors for even more personalized application (please search online for more information, since there are some good examples of this). I plan to test the same code in Labview, but with GPU (nvidia) support (also OpencCV) and a live video stream, but i am currentlly having issues with my graphics card.

Here is the sample result of the image i got online (i hope i am not in violation of any copyrights 😞

hog_openCV_FP.jpg

I am also attaching the c++ source code, the dll and a LV2010 sample program. Code is compiled with VS2010 x86 and OpenCV 2.4.5. Add  "...\opencv\build\x86\vc10\bin" to system path or recompile the source code yourself.

Be creative.

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Comments
fra_celi
Member

Hello Klemen,

I'm actually working on openCv and LabVIEW, and I found your post really interesting. I'm working with LabVIEW 2013, VS2013 x86 and OpenCv 2.4.9. I rebuilt the dll from your source code but unfortunately, when I try to run the VI, LabVIEW crashes, reporting an access violation exception. Do you have any idea about the reason of this problem? thanks in advantage!

Klemen
Active Participant

Hello,

can you post the screenshot of the error?

I have just tested the code on my machine (VS 2010, LV2013 and OpenCV 2.4.6) and it works ok.

Did you rebuild the source code successfully? Any errors/warnings? Did you change anything?

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
fra_celi
Member

I successfully rebuilt the code, no errors, no warnings. I've attached the print screen of the VI's block diagrams.

It seems like the start_hog function doesn't detect anything or have some problems with input parameters and returns 0. https://www.dropbox.com/s/i8vb5lsbc1ih3vq/img.png

I had the same problem with your hough circle example. I've also tried histogram matching example. in that case everything works fine, and I guess it's the way of get the image input. In the histogram matching, you get the 3 channels as unsigned __int8 pointers. In this example like the one of hough circles, the image is passed as uchar. Maybe this could be the problem.

Klemen
Active Participant

Hello,

I don't think the problem is in the datatype, since both datatypes have the same width. If you take a look at uchar typedef its actually unsigned char, which is equal to unsigned _int8. See here:

http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx

You can change the datatypes to unsigned _int8 and rebuild the .dll and give a try...

If no people are detected the function "get results" returns nonzero value. The "start_hog" seems to give you problems, but I cannot say why... I have tested the program again right now with different images and encountered no problem. Can you change the "platform toolset" under project properties in VS to v100 and rebuild the .dll? Also, you can try with OpenCV 2.4.6 and VS2010? It could be some compatibility issue... 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
shruthim.nayak
Member

Hello,

I am doing the project to similar to the above one. I have downloaded your attached vi's and dll.

I am able to open the code but its giving error as dll missing. when i try to change the path of dll, i will get an error indicating opencv_245.dll is missing. Can you please guide me what all i need to install to open this vi as i dont have idea on opencv.

Also is it possible to do only in labview without using  opencv