cvLatentSvmDetectObjects returns empty sequence [closed]

asked 2015-11-05 05:10:44 -0500

Hello everyone!

I'm trying to execute the example code of LatentSVM included in 'samples/c/latentsvmp.cpp' of openCV 2.4.11 version, but when the function cvLatentSvmDetectObjects is called always return an empty sequence. I'm using the default configuration and files given, do you have the same problem?

detections = cvLatentSvmDetectObjects(image, detector, storage, 0.1f, numThreads);

Thanks for all!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-07 07:28:27.859363


try cv::LatentSvmDetector::detect or cv::dpm::DPMDetector::detect. cvLatentSvmDetectObjects is deprecated C-API

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-11-05 07:51:20 -0500 )edit

Hello! First of all thanks for reply :), I've tryed your solution but the problem is still there, I've realized that the sequence given by the method is maybe bad constructed, for example, if I have this code:

CvSeq* detections = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvPoint)*2, memStorage);
int i = 0;
int64 start = 0, finish = 0;
try{printf("detections %f\n", (float)detections->total);}catch(Exception e){}
start = cvGetTickCount();
detections = cvLatentSvmDetectObjects(image, detector, storage, 0.1f, numThreads);

I've got that detections size is 0 before LatentSVM call, but if I try to count the size of detection after that the program crashes without log any information... What is happening?

Thanks again :).

Juandisims gravatar imageJuandisims ( 2015-11-06 02:13:36 -0500 )edit

please replace all the *.h bu *.hpp in includes and all cvMethodName by cv::methodName. So you are not in need of CvSeq*, but std::vector< cv::LatentSvmDetector::ObjectDetection >; so this should look something like:

std::vector< cv::LatentSvmDetector::ObjectDetection > detections;
int i = 0;
cv::LatentSvmDetector::detect(image, detections, 0.1, numThreads);

more, it is normal to have 0 before detection, because you have nothing put inside the detections, so it is an empty vector/pointer.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-11-06 02:33:47 -0500 )edit