Ask Your Question

Dženan's profile - activity

2017-10-14 15:55:26 -0500 received badge  Notable Question (source)
2015-06-04 02:03:34 -0500 received badge  Popular Question (source)
2013-06-18 08:19:27 -0500 commented answer CascadeClassifier.detectMultiScale takes a minute! Why?

I have made several different detector cascades, the most recent one with these parameters: -w 16 -h 16 -featureType HAAR -mode ALL -numPos 7500 -numNeg 7500 -numStages 30 -minHitRate 0.998

Such high number of positive samples come from having 11 rotated versions of each real sample. Real positive sample count was 864. Assembling the training data is the biggest part of the job of creating a detection cascade.

2012-12-13 07:20:19 -0500 received badge  Editor (source)
2012-12-13 06:59:17 -0500 asked a question Group rectangles over multiple images

I have multiple slices of a magnetic resonance image. On each slice I run my cascade detector for vertebra. There is a certain number of false positives, but usually in different places on different slices.

Is there a way to group rectangle candidates over multiple images, instead of just over a single 2D image? I mean, without modifying OpenCV source code?

image description image description image description

2012-12-05 06:23:08 -0500 commented answer CascadeClassifier.detectMultiScale takes a minute! Why?

The long running time problem, yes. I have left to solve the good classifier problem, mostly meaning to assemble good positive/negative data.

2012-12-04 08:32:57 -0500 asked a question Object detection on labeled images only

I want to train a vertebra classifier (in magnetic resonance images).

I was wondering if there is a tool which uses labeled images only, that is images with objects labeled by rectangles? Instead of creating a vector of positive samples which are to be placed at random locations in supplied background images, is there a tool to use labeled images?

Use already existing image, just knowing where the objects are and consider everything else as background. Would this way have some advantages over the classic way?

Example images:

image description image description

2012-12-04 08:01:12 -0500 commented answer CascadeClassifier.detectMultiScale takes a minute! Why?

With better classifier, detection time is 639 ms. So number of detections was the problem.

2012-11-30 08:21:36 -0500 commented answer CascadeClassifier.detectMultiScale takes a minute! Why?

I realized that grouping detected rectangles takes a long time, longer than the detection itself. With better detector it will be less of a problem.

2012-11-30 04:49:58 -0500 commented question CascadeClassifier.detectMultiScale takes a minute! Why?

Image resolution is 512x512. Increasing the number of neighbors to 4 changes nearly nothing. Number of detections is about the same, and execution time is the same.

2012-11-29 10:25:52 -0500 asked a question CascadeClassifier.detectMultiScale takes a minute! Why?

I am trying to create a vertebra detector. After manually creating a small set of training and background images, trained a classifier, and am now trying to use it. Results are nonsense, but that I expected. The problem I am having is very long running time ~ 1 minute for one image, instead of some ~ 100ms, for release build.

What am I doing wrong?


detection time = 65799.5 ms


#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main(int argc, char* argv[])
    CascadeClassifier cascade;

    cv::Mat img = cv::imread("D:/img.png",0);

    int i = 0;
    double t = 0;
    double xres=0.625, yres=0.625;
    vector<Rect> faces;

    equalizeHist(img, img);
    t = (double)cvGetTickCount();
    cascade.detectMultiScale( img, faces, 1.1, 2, 0,
        Size(10/xres, 10/yres), Size(55/xres, 55/yres) ); //min 10mm, max 55mm
    t = (double)cvGetTickCount() - t;
    printf( "detection time = %g ms\n", t/((double)cvGetTickFrequency()*1000.) );
    for( vector<Rect>::const_iterator r = faces.begin(); r != faces.end(); r++, i++ )
        Point center;
        Scalar color = CV_RGB(255,255,255);
        int radius;
        center.x = cvRound((r->x + r->width*0.5));
        center.y = cvRound((r->y + r->height*0.5));
        radius = cvRound((r->width + r->height)*0.25);
        circle( img, center, radius, color, 3, 8, 0 );
    cv::imshow( "result", img );

    return 0;
2012-11-29 02:41:41 -0500 answered a question CMake ${OpenCV_LIBS} corrupted

I have found a workaround. When configuring OpenCV, CMake configuration variables WITH_CUDA, WITH_CUBLAS and WITH_CUFFT should be unchecked (set to false). That way the offending libraries are not included at all.

The second option which worked for me was to use version 2.4.3 instead of 2.4.2, which worked also with CUDA included.

2012-11-27 02:43:50 -0500 received badge  Autobiographer
2012-11-27 02:33:55 -0500 asked a question CMake ${OpenCV_LIBS} corrupted

A simple CMake project produces corrupted libraries for linking. CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
PROJECT(bugTester CXX)


ADD_EXECUTABLE(bugTester bugTester.cpp)

When trying to generate the project files, I get this:

CMake Warning (dev) at CMakeLists.txt:7 (ADD_EXECUTABLE):
  Policy CMP0008 is not set: Libraries linked by full-path must have a valid
  library file name.  Run "cmake --help-policy CMP0008" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "bugTester" links to item


  which is a full-path but not a valid library file name.
This warning is for project developers.  Use -Wno-dev to suppress it.

Generating done

The offending "C:/Program" can be easily tracked down to contents of ${OpenCV_LIBS} variable. Besides normal stuff, it also contains these:


and those should be:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/npp.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

It is obvious that spaces in library paths were incorrectly used to break libarary names.

Is there some fix or workaround for this? Would completely removing GPU modules from OpenCV configuration solve this?

2012-11-27 02:19:49 -0500 received badge  Supporter (source)