Ask Your Question

Problems using createsamples function for lbp cascade classifier

asked 2016-07-12 09:48:52 -0500

ThorbjornSomod gravatar image


I recently got into computer vision, machine learning and object detection, and I am currently working on an object detector written in C++11 and based on OpenCV3.1. I am using VisualStudio15 with OpenCV installed. My problem lies in creating the .vec files for use in training my LBP classifier. I just can't get it to run using VS. I haven't really tried too many things as there isn't much documentation on this laying around, but I thought you guys might be able to help me sort this out.

What I've done so far: - Created a new blank cpp project "createsamples" - Added source files "createsamples.cpp" and "utility.cpp" found under "Opencv310\sources\apps\" - Added header file "utility.hpp" found under the same directory

When i try to compile this (with no specific files ect.) i get error messages on the form:

"Severity Code Description Project File Line Suppression State Error C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. createsamples c:\opencv310\sources\apps\createsamples\utility.cpp 866"

Any tips? What I want is a .exe file for use in a .bat file for the creation of the .vec file for positive samples. Any help would be greatly appreciated!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-07-13 08:28:41 -0500

MRDaniel gravatar image

Yeah. You need to change to fopen_s as fopen is unsafe.

You'll see the parameters for these functions are similar

stream = fopen(a,b,c)


fopen_s(&stream, a, b, c)

It's more of a C++ problem than an OpenCV one.

If you build OpenCV it should create a utility for generating samples.

Here's a good tutorial....

edit flag offensive delete link more


Thank you for the help! I solved it myself by ticking off an error notifier in VS, but i will you the method you stated the next time, as it is more correct :)

ThorbjornSomod gravatar imageThorbjornSomod ( 2016-07-13 11:39:59 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-07-12 09:48:52 -0500

Seen: 140 times

Last updated: Jul 13 '16