Ask Your Question

vinayverma's profile - activity

2020-10-23 09:13:12 -0600 received badge  Nice Question (source)
2018-11-28 17:35:58 -0600 received badge  Notable Question (source)
2018-01-12 02:18:09 -0600 received badge  Popular Question (source)
2017-12-09 09:14:46 -0600 received badge  Popular Question (source)
2017-09-01 01:22:23 -0600 received badge  Popular Question (source)
2016-09-26 11:37:06 -0600 received badge  Necromancer (source)
2016-09-26 11:37:06 -0600 received badge  Self-Learner (source)
2014-12-09 13:53:17 -0600 marked best answer HaarTraining: Best way to minimally crop +ve images (for efficient detection)

First of all, I am not talking about the utilities that can be used to crop positive images.

I want to know the best way to crop the object of interest so that minimal number of +ve images produce good detection results. There can be two types of objects,

  1. Which can be cropped easily with a rectangle including considerable number of object features (objects roughly in rectangular/circular shapes)

  2. Whose features cannot be captured easily in rectangle without keeping the background too in the cropping rectangle (objects in shapes like star maybe; like aircraft)

I have attached a sample cropped image of an aircraft. I am trying to build a cascade classifier with similarly cropped images but my training doesn't proceed beyond 4 stages (False detection rate achieved with 4000 +ves, 30000 -ves).

Please suggest:

  1. Is it because of my cropping style or something else is wrong, that the learning stops at stage:4

  2. I am using images from a single aircraft model at fairly close angles (extracted from a video), but still covering 180 deg view I require for detection. It it required to have +ve images only from same view angle?

  3. Please use the attached cropped image and suggest what would be the best cropping style for these type of objects.


image description

2014-12-09 13:49:25 -0600 marked best answer HaarTraining: Find detected object with highest score

Need to detect only the object (single instance) with maximum score/confidence using HaarTraining. I have obtained a cascade classifier for my object ( using 1000 Positives, 21000 Negatives) and tried to use it with opencv facedetect example in C++. It is detecting my object whenever present but in addition, there are atleast 10 more objects detected (false detection). Is it possible to find out the object with highest score/confidence in the list returned by CascadeClassifier.detectMultiScale(). Is it somehow obtained using rejectLevels & levelWeights? I can't find any documentation related to this.

I have already tried it successfully with latent svm. It returns the score along the detection list as well but it takes lot of time in processing the frame.

2013-09-25 00:18:10 -0600 commented question How may I solve this?

Please refer to the following question:

You can also have a look at the motion detection sample in OpenCV installation.

2013-09-23 00:24:58 -0600 commented question Object detection :facing problem while detecting objects

Are the current detections more in the region where bottle is? In other words, are there more detections at the bottle and lesser at other places? If that is so, try to increase your minimum nieghbour parameter used during detection.

2013-09-23 00:21:49 -0600 commented question speeding haar training

Try traincascade its faster and requires exactly same inputs which you must have prepared for haartraining.

2013-09-23 00:07:19 -0600 commented question How may I solve this?

I think to start with you can use traincascade HAAR/LBP to train a model for tunas. Once its done, you can programmatically find out how many detections passed the vertical line. You can try LBP first as it takes lesser time to train and has comparable detection quality too.

On another thought, it seems that the only motion here would be tunas (or other fishes; atleast at the right side?). If thats true, you can also utilize motion detection alone or even together with traincascade to have more accurate solution.

2013-09-02 00:17:56 -0600 commented question really bad false detections

What was the Acceptance Ratio for stage 13?

2013-08-07 11:45:14 -0600 received badge  Necromancer (source)
2013-08-07 09:40:36 -0600 answered a question compiling traincascade

All we need to do is the following:

  1. Install OpenCV with visual studio (You'll easily find several links to do so if you search)

Once step 1 is complete, I assume you'll be able to compile sample opencv applications in visual studio.

  1. Include all the files present in the traincascade directory in your opencv installation to your project.

  2. Just compile !

Thats it.

2013-08-07 09:16:17 -0600 commented answer Problem: haartraining.exe crashes while training

I think thats right. Better to use traincascade.

2013-08-06 23:26:07 -0600 commented question OpenCV Error : Assertion failed during haartraining

I think you'll have to play with npos/nneg only. You can try increasing number of negatives too.

2013-08-06 07:29:38 -0600 answered a question Problem: haartraining.exe crashes while training

Try to run it with lesser number of npos (say 1000-1020). There must be some images in your vec file which cannot be used for training. So if the parameter is less than the actual number of images in vec file, you still have some buffer images to use (in case of non-usable pos images).

When the error window opens, also look at the console to see the exact error.

2013-08-05 14:44:12 -0600 commented answer Plz Help! Can not debug grogram

The code you posted didn't have canny operation but just cvPyrDown. The fix I mentioned works for that. Even now you didn't post your new code.

Use the following code, it works fine:

IplImage* img = cvLoadImage( "F:\\chandung.png", 0);
cvNamedWindow( "Example4-in" );
cvNamedWindow( "Example4-out" );

// Show the original image
cvShowImage("Example4-in", img);

// Make sure image is divisible by 2
assert( img->width%2 == 0 && img->height%2 == 0);

// Create an image for the output
IplImage* out = cvCreateImage( cvSize(img->width/2,img->height/2), img->depth, img->nChannels );

// Reduce the image by 2
cvPyrDown( img, out );

// Perform canny edge detection
cvCanny( out, out, 10, 100, 3 );

// Show the processed image
cvShowImage("Example4-out", out);

cvReleaseImage( &img );
cvReleaseImage( &out );
cvDestroyWindow( "Example4-in" );
cvDestroyWindow( "Example4-out" );
2013-08-05 06:54:48 -0600 asked a question HaarCascade MinNeighbors: Required to tweak manually for different videos?

I have trained a HaarCascade which gives good detection for any test video for a specific MinNeighbors parameter. The problem is that when the detection is tried on a different video, I need to manually adjust the MinNeighbors parameter again to get good detection with less False Positives.

Is it because the number of images in my training data are not distributed equally for various kind of scenes/backgrounds etc (for e.g. I have more day time images than night time, so the parameter is different for day/night test videos)?

Similarly, the positive images are different in terms of image quality and the number is not same for all types of image quality (good/bad/blur: more good less bad/blur).

Is there any way to manage the change of MinNeighbors programatically (avoiding manual change for each video)?

2013-08-05 06:09:15 -0600 commented answer Plz Help! Can not debug grogram

Note: Edited to create half size image.

2013-08-05 04:31:05 -0600 answered a question Plz Help! Can not debug grogram

Try using this:

IplImage * out = cvCreateImage( cvSize(in->width/2,in->height/2), in->depth, in->nChannels )

You need a half size image here.

I think this would help.

2013-08-04 01:11:13 -0600 commented question Runtime error with opencv_createsamples

Can you try to it on a different image. Sometimes CreateSamples doesn't work on some images (may be corrupt headers?).

2013-08-04 00:52:59 -0600 answered a question OpenCV Error: Assertion Failed (size.width>0 && size.height>0) in unknown function

I believe you are using Visual Studio. You need to put the file in your project directory (i.e. $(ProjectDir)).

Note that this is different from solution directory. In simple words, it is the directory where your project code files are added by default (When you click Add->New Item).

Hope this helps.

2013-08-03 23:12:51 -0600 commented answer Removing jitter/shaking effect in Haar Cascade detection bounding box

I have applied similar approach to size as well. Now ignoring sudden size changes above than a threshold. Also, below that threshold, I am considering the largest bounding box. Working perfectly fine till now.

2013-08-02 03:00:01 -0600 commented answer Removing jitter/shaking effect in Haar Cascade detection bounding box

Thanks Steven. I also tried that. But in my case sometimes the size of bounding box also changes. So the overlapp area is keeps changing. Also, I am doing almost realtime processing but still I think keeping relevant previous detections wont hurt much.

2013-08-02 02:11:26 -0600 asked a question Removing jitter/shaking effect in Haar Cascade detection bounding box

I have a trained classifier for Haar, with good detection most of the times. It has few false positives but for most of the frames it detects the actual object well. The problem is that the bounding box over the actual object keeps shaking a bit (even if my object is stationary) and the size of rectangle also keeps fluctuating.

I need the bounding box to be stable and in terms size and position for some distance calculations. I tried using motion detection and fixing the position if object is stationary, but it stabilizes the false positives as well.

Are there any implementations already available to achieve this?

I am also considering 2d feature matching to stabilize the rectangle (finding the previous detection around the new detection). Would it be a good idea.

Please suggest the possible approaches. Any already existing implementation would be great.


2013-07-29 02:00:09 -0600 asked a question Border removal from video

I need to remove border from some videos for further processing. The border is always black and the actual video is centered. Do I need to traverse the Mat, find the actual dimensions of the video by checking for black color, and then get the sub-Mat? Or is there any existing simpler method for the same?


2013-07-15 03:54:47 -0600 commented question Is there any mechanism/algorithm for contour based object detection?

Thanks Kirill. I'll look at these.

2013-07-12 05:06:26 -0600 asked a question Is there any mechanism/algorithm for contour based object detection?

Is there any mechanism/algorithm for contour based object detection? So that we can also get the dimensions of subparts of our detected object (rather than obtaining a bounding box around it). Any ideas please?


2013-07-11 06:31:34 -0600 commented answer Video Recording is too fast

Use the following: writer->open("D:/OpenCV Final Year/OpenCV Video/MyVideo.avi",CV_FOURCC('D','I','V','X'), cam1.get(CV_CAP_PROP_FPS),*s,true);

This would not work if your cam doesn't support ioctl for getting fps. So just put a breakpoint and check if cam1.get(CV_CAP_PROP_FPS) returns 0.

If that is the case, I think you can still manually tweek the fps parameter and set it to the value for which your output video runs with normal speed (not a good way though).

2013-07-11 00:26:19 -0600 answered a question Video Recording is too fast

This is a probable mismatch between the fps of your cam and your output video (10). If you match the fps of VideoCapture and VideoWriter, the speed would be normal. I think that should work.

You can also verify if changing the fps in VideoWriter changes your output video speed.

2013-07-10 05:46:44 -0600 received badge  Student (source)
2013-07-10 05:10:41 -0600 commented question LatentSVM: svmlight training parameters

Thanks Steven for the formatting. I was just searching for the formatting options and found that you formatted it. Thanks.