Commit 840088e0 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Get rid of cvconfig.h in Latent SVM samples. Use common OpenCV parallel…

Get rid of cvconfig.h in Latent SVM samples. Use common OpenCV parallel framework instead of direct TBB calls.
parent a5969aec
...@@ -51,7 +51,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -51,7 +51,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endforeach() endforeach()
endif() endif()
if (INSTALL_C_EXAMPLES AND NOT WIN32) if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
install(FILES ${C_SAMPLES} install(FILES ${C_SAMPLES}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
......
...@@ -2,13 +2,6 @@ ...@@ -2,13 +2,6 @@
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_CVCONFIG_H
#include <cvconfig.h>
#endif
#ifdef HAVE_TBB
#include "tbb/task_scheduler_init.h"
#endif
using namespace cv; using namespace cv;
static void help() static void help()
...@@ -31,28 +24,13 @@ static void detect_and_draw_objects( IplImage* image, CvLatentSvmDetector* detec ...@@ -31,28 +24,13 @@ static void detect_and_draw_objects( IplImage* image, CvLatentSvmDetector* detec
CvSeq* detections = 0; CvSeq* detections = 0;
int i = 0; int i = 0;
int64 start = 0, finish = 0; int64 start = 0, finish = 0;
#ifdef HAVE_TBB cv::setNumThreads(numThreads);
tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred);
if (numThreads > 0)
{
init.initialize(numThreads);
printf("Number of threads %i\n", numThreads);
}
else
{
printf("Number of threads is not correct for TBB version");
return;
}
#endif
start = cvGetTickCount(); start = cvGetTickCount();
detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads); detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads);
finish = cvGetTickCount(); finish = cvGetTickCount();
printf("detection time = %.3f\n", (float)(finish - start) / (float)(cvGetTickFrequency() * 1000000.0)); printf("detection time = %.3f\n", (float)(finish - start) / (float)(cvGetTickFrequency() * 1000000.0));
#ifdef HAVE_TBB
init.terminate();
#endif
for( i = 0; i < detections->total; i++ ) for( i = 0; i < detections->total; i++ )
{ {
CvObjectDetection detection = *(CvObjectDetection*)cvGetSeqElem( detections, i ); CvObjectDetection detection = *(CvObjectDetection*)cvGetSeqElem( detections, i );
......
...@@ -90,7 +90,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -90,7 +90,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endforeach() endforeach()
endif() endif()
if (INSTALL_C_EXAMPLES AND NOT WIN32) if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
install(FILES ${C_SAMPLES} install(FILES ${C_SAMPLES}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
......
...@@ -9,14 +9,6 @@ ...@@ -9,14 +9,6 @@
#include <dirent.h> #include <dirent.h>
#endif #endif
#ifdef HAVE_CVCONFIG_H
#include <cvconfig.h>
#endif
#ifdef HAVE_TBB
#include "tbb/task_scheduler_init.h"
#endif
using namespace std; using namespace std;
using namespace cv; using namespace cv;
......
...@@ -80,7 +80,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -80,7 +80,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
include("performance/CMakeLists.txt") include("performance/CMakeLists.txt")
endif() endif()
if (INSTALL_C_EXAMPLES AND NOT WIN32) if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
install(FILES ${install_list} install(FILES ${install_list}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
......
...@@ -51,7 +51,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -51,7 +51,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endforeach() endforeach()
endif() endif()
if (INSTALL_C_EXAMPLES AND NOT WIN32) if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
install(FILES ${install_list} install(FILES ${install_list}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment