Ask Your Question

Prasanna's profile - activity

2019-04-28 19:54:00 -0600 received badge  Popular Question (source)
2017-08-13 20:38:10 -0600 received badge  Nice Answer (source)
2016-05-30 06:45:43 -0600 commented question ConDensation algo

Oh. I didn't see the date :D Maybe I will try mashing it up and if something comes up I will let you know.

2016-05-30 06:39:57 -0600 commented question How to use Opencv 3 particle filter api

Maybe Rect res is Rect(0,0,0,0) as _last_guess might have converged to 0,0,0,0. You should probably check that to confirm.

2016-05-30 05:47:56 -0600 received badge  Commentator
2016-05-30 05:47:56 -0600 commented question ConDensation algo

I still don't get why you need to add a specific rule (swarm / hog) in the implementation of particle filter. Won't the distribution by itself take care of that? The particles might be unstable but the mean estimate of the state need not be that unstable. This blog seems to have a strategy for resampling and regularizing.

2016-05-30 05:16:20 -0600 commented question ConDensation algo

Are you still maintaining this code elsewhere (github, bitbucket, etc.)? If so, can you post a link here? Has it been updated after this?

2016-02-03 13:41:25 -0600 received badge  Nice Answer (source)
2014-11-08 02:35:50 -0600 received badge  Taxonomist
2014-05-07 11:59:35 -0600 commented answer Stereo Vision Related Queries

Well that was an amazing video indeed. Thanks. I came across this kind of sensors under the name of Neuromorphic Cameras and Optical Flow sensors. Pretty amazing things they are.

Regarding S3E, The technique they used is based on a concensus transform or something - Never heard of it before. Will share any details if I come across anything interesting.

2014-05-07 11:49:36 -0600 commented answer Stereo Vision Related Queries

Well, Maybe you should wait for Kinect 2.0 with which you can experiment with Time of Flight for depth. There are these techniques which I came across - Depth from blur, Depth from defocus, Depth from Photometry - Don't know anything about their performance, just heard about them. Maybe you wanna look into them.

What I actually meant by curvature was - When you set your stereo rig in front of a curved surface like a cylinder / sphere, Can you get a depth map such that the depth will vary as you move along the surface or will it just be like a depth map you get from repeating the experiment with a cube?

In short - Will you be able to differentiate a cube from a cylinder of same dimensions - side of cube = height of cylinder = dia. of cylinder?

2014-05-07 10:48:18 -0600 commented answer Stereo Vision Related Queries

Well, I haven't come across any real time stereo algorithm working without any additional hardware like GPGPUs etc. The video link you posted was indeed a surprise to me - How could they possibly do it? I will dig a bit more. Thanks for sharing! I know you would have come across devices like kinect (Infrared ) and Time of Flight Cameras. Why don't you give them a try too? They seem to work real time. And regarding curvature, I didn't get your point on how HoG helps. Can you please elaborate? I will be happy even if someone can point out if its impossible to get the curved surface of a cylinder / sphere with a stereo rig.

2014-05-07 10:42:42 -0600 received badge  Nice Question (source)
2014-04-14 19:13:03 -0600 commented question Having a set of 4-10 photos of a single object how to get point cloud of that object using OpenCV?

Check this out. https://github.com/MasteringOpenCV/code. Check chapter 4.

2014-01-10 02:58:18 -0600 asked a question [solved]Runtime Error at end of program - "pure virtual method called"

UPDATE

I think I got the problem solved. It was due to a destructor of a Global Mat being called after the program ends. Its funny that this should happen. I donno whether to call this a bug or not. I released it just before the return statement of main function and things are fine.

PS: If you want to replicate error, try using a Global Mat with just a simple "imread - imshow - waitKey " program.

.

Actual Question

I was running some OpenCV (3.0.0) codes today. I stumbled upon the following runtime error.

pure virtual method called

terminate called without an active exception

Aborted (core dumped)

This is my gdb backtrace.

(gdb) bt
0  0x00007ffff615bf77 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

1  0x00007ffff615f5e8 in __GI_abort () at abort.c:90

2  0x00007ffff67636e5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-
gnu/libstdc++.so.6
3  0x00007ffff6761856 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

4  0x00007ffff6761883 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

5  0x00007ffff676235f in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

6  0x00007ffff74d5d8c in cv::Mat::deallocate() () from /usr/local/lib/libopencv_core.so.3.0

7  0x0000000000405fdb in cv::Mat::release() ()

8  0x0000000000405d40 in cv::Mat::~Mat() ()

9  0x00007ffff6161071 in __run_exit_handlers (status=1, listp=0x7ffff64e66a8 <__exit_funcs>,   run_list_atexit=run_list_atexit@entry=true) at exit.c:77

10 0x00007ffff61610f5 in __GI_exit (status=<optimized out>) at exit.c:99

11 0x00007ffff6146dec in __libc_start_main (main=0x405451 < main >, argc=2, ubp_av=0x7fffffffe048, 
init= < optimized out > , fini= < optimized out >, rtld_fini = < optimized out >, stack_end=0x7fffffffe038) at libc-start.c:294

12 0x0000000000402f49 in _start ()

When I did some searching around, people pointed out some deallocation / access after lifetime and some were about threads. But I didnt get head or tail of it.

It would be nice if someone could give an explanation.

2014-01-09 08:28:38 -0600 commented question Generate video output (streaming)

I think there is one more thing you can do about this. You can use the 'appsrc' element in GStreamer to do this. I haven't tried it out myself. But I just know its possible. Check it out if you are still exploring. :)

2013-10-15 07:27:18 -0600 received badge  Good Answer (source)
2013-08-23 18:28:43 -0600 commented question Number plate segmentation C++

There is something called hierarchy in contours. Look it up. Maybe it can help you. A Naive way is area constraint. Just remove the 'contour' having highest area, has a 'hole' inside or something like that. (If you dont know what is the difference in 'hole' and 'contour', check the learning opencv oreilly book).

2013-07-19 06:47:51 -0600 commented question Verify vector file and background file

Hey Steve, Look what happened to your asterisks. Edit it before you confuse others. :D

2013-07-19 06:45:21 -0600 commented question Accessing Point<int> (Point2i) data from memory

What you can also try is to use std::vector of points. This will eliminate the malloc (did you forget to allocate memory in any case? ) step and problems associated with pointers. For example, std::vector<Point> points; and use push_back to add points to the vector, like this, points.push_back( Point(x,y) ); and you can access by points[i] where i is index.

Try to use vectors whenever possible (but sadly there are drawbacks too. :( But on the bright side, its way better and easy to handle than pointers)

2013-07-18 08:51:46 -0600 commented question Verify vector file and background file

Theres a waitKey(0) between showing samples from a vec file. Hit the enter key to go ahead. Make sure you merge the vecs created for each image.

2013-07-18 02:37:20 -0600 commented question Verify vector file and background file

You can open your "negative.dat" file in a text editor. As for verifying a vec file, Use the opencv_createsamples.exe by passing vec file, width and height as arguments and -show option. (For example, opencv_createsamples.exe -vec imgs/vector.vec -w 640 -h 480 -show). But why are you using such high resolution like 640x480? It will take ages to train.

Try following this for a start.

2013-07-17 04:07:37 -0600 commented question error in train casacde

Wait a sec. I didn't point that out as a solution to the actual problem. My guess is to try passing paths with a " ./ " preceding it. So it should look like ./negative/UMD_001.jpg . Tell me if it works.

2013-07-17 01:43:49 -0600 commented question error in train casacde

Parameter which you passed is "preCalcValBufSize" while it should have been precalcValBufSize. Similarly in the case of "precalcIdxBufSize". Its a sad thing that the parameters are not checked by the program. Double check your bg file too.

2013-07-12 06:55:17 -0600 commented question The elusive road to LBP cascade training... help!

If you need more help, contact me at [email protected]. I can share my experience with cascade classification with you

2013-07-12 06:52:22 -0600 commented question The elusive road to LBP cascade training... help!

My guess is the data chosen for training is not correct. The training is suffering too much from the variance in the data set and trying to add more features to discriminate between them and ending up being a BIG FAT cascade. Please Note that Its a guess.

And I really want to appreciate your idea. Nice work.

And i would suggest that instead of making a very robust detector, make one for the situation at hand. Take natural positives and negatives from the scene where it is used. You can make a cascade with few images, but you wont be able to capture all possible 'test' cases with a small dataset.

One more thing. You can also try other feature evaluators other than LBP like HOG,HAAR etc. You can also try SIFT, SURF, etc. too.

2013-07-12 04:27:01 -0600 commented question Generate a xml file: error with createsamples

I am really sorry, there are back quote marks (below tilde symbol) marks before and after pkg-config. So the command is g++ -o facedetect facedetect.cpp(back quote)pkg-config --cflags --libs opencv(back quote)` My bad.

And why do u need relative path for PKG_CONFIG_PATH? Use absolute path of opencv.pc in export command.

2013-07-11 20:53:11 -0600 commented question Generate a xml file: error with createsamples

I assume that the quote mark ( ' ) at the end of your previous comment (cv::CascadeClassifier::CascadeClassifier()') was a mistake. All I wanted to know was whether your opencv has been built correctly or not as these errors can come because of that too. Try compiling and executing some other program and test if opencv works.

pkg-config takes care of all the linking provided its used correctly. Verify whether the path is set by using : echo $PKG_CONFIG_PATH command in terminal.

For compiling, g++ -o facedetect facedetect.cpp pkg-config --cflags --libs opencv

2013-07-11 15:45:18 -0600 commented question Cannot find documentation of cmake options

One more thing that you can do is edit the CMakeCache.txt generated after running cmake command without any parameters. Otherwise, You can also use the CMake GUI and select the advanced check box to see all the optional Parameters. Hover your mouse over the options to get a small description about the parameters.

2013-07-10 04:08:10 -0600 commented answer USB video capture to cuda

I dont think I understood your requirements completely. But, As far as I understood, you wont touch CUDA code as long as your are using OpenCV for your application as it is all wrapped up into the gpu module. (its kinda sad as the opportunity to learn CUDA goes down :( ).

If you want to use CUDA code, you need to get to the base of the streamer (for grabbing video frames) and convert it into the format which your code can accept. Looks tough (I havent tried it though). Otherwise, OpenCV has all the major things you will need. (Edge detection -> Canny, Template matching -> gpu::matchTemplate)

You can process at a greater FPS on videos, but not on cam as you need to upload and download data everytime (to the GPU) which results in lower fps.

2013-07-10 03:54:46 -0600 commented question Generate a xml file: error with createsamples

In the folder C:\cygwin\tmp\opencv-2.4.5\samples\c\, there will be a file facedetect.cpp. Try compiling it. ( If you have specified the 'build all examples' flag when you built OpenCV, you will find a facedetect.exe (or) a c-example-facedetect.exe in the bin or somewhere. Search for it.) Try running it. It is just to make sure your OpenCV and its utilities are built properly.

2013-07-09 07:25:18 -0600 commented question Generate a xml file: error with createsamples

Hey there. Can you please let us know if you are able to run other samples like facedetect, etc.?

2013-07-09 06:49:07 -0600 commented question Is the Erode and Dilate images mixed up in the Doc

Not sure if the error has been rectified or you got it all wrong :| .

Dilate -> Local Maximum. Erode -> Local Minimum.

2013-07-07 04:10:37 -0600 commented question Image loading and display problem

It depends on what you passed as the command line argument. If it is the relative path, the picture must be in the folder having the executable generated by building the project. If it is the absolute path, well, that's a weird error.

2013-07-06 05:32:00 -0600 answered a question Unable to create positive samples

Its really awesome that you made your own tool. Let me clear the air about opencv_createsamples. See if it helps.

You need to use the opencv_createsamples utility on each of the positive images (you have to pass image and not info.dat) and create 5 new images with different (random) distortions (perspective and intensity). You can skip bg file (A black background will be used if you do). This will create a vec file for each of the image with the distortions. Then you should use the mergevec.cpp to merge these vecs into one. Kindly look at the tutorial for more info about this merging of vec files. (You will have 109 vec files and 109*5 positive samples if you use -num 5)

Note : These images created are not a perfect substitute for the lack of original images. They seem to work but they cant capture all of the "variance" in the positive class. It will work the best when you have 600 natural positive images.

So,

  • Use createsamples utility to generate the vec file for each image with random distortions
  • Merge these vec files using mergevec.cpp provided here along with instructions.
  • Put the path of negative images (relative to bg.txt) in bg.txt
  • Pass the final (merged) vec file, bg.txt, and the rest of the parameters (like feature type, stages, falseAlarm Rate, HitRate, etc.) to traincascade to train.

But once again, It was really nice that you put time into it and solved it in a different way.

If you need any more clarifications, comment below. Glad to help.

Regards,

Prasanna S

PS : We need that guide soon, @steve. People are losing hope on opencv_createsamples utility :( . Hope the developers' feelings aren't hurt.

2013-07-05 05:16:26 -0600 commented answer memory consumption while training > 50GB

Actually, It will be very helpful to have a single guide because all the guides presently available online are sort of incomplete and the tutorial i mentioned is the best one i came across so far. I don't think you guys need help, but If you do, consider me in. I am not a pro but would love to help. Cheers!

2013-07-05 04:45:51 -0600 received badge  Nice Answer (source)
2013-07-05 03:21:02 -0600 commented question Has anyone tried doing mesh based image warping with OpenCV? If yes, how to do it?

Maybe you should look into ITK and its examples for a solution. (Donno if you will find something suitable. Just suggesting) It has OpenCV IO Bridge as well.

2013-07-05 00:53:14 -0600 answered a question memory consumption while training > 50GB

It may not be an answer as such but its too long for a comment. So here it goes.

CreateSamples

You can actually use this utility in four ways. You can use it for :

  • Creating Distorted Training samples - Perspective Transform , Intensity Variation, etc.
  • Undistorted Training samples - Just a rectangular crop, incase you have too many samples already
  • Annotated Test Samples - Useful for testing performance of your cascade after training
  • And to see whats there in a Vec file (provided you know the size of the samples used to create it) - Useful for seeing and verifying what you really want is there in it.

Traincascade

It's pretty much covered in the OpenCV Documentation. Let me point you to another link. One of the best and detailed tutorial for HAAR training and can be easily extended to LBP and HOG with ease, thanks to OpenCV Developers

Regarding Size and to know why it blows up go check the haarfeatures.cpp in $OpenCV_DIR/apps/traincascade/ and check the "void CvHaarEvaluator::generateFeatures()" and try calculating how many "sums" you are creating per image and add the size of integral images to that also. That should give you a fair idea about the requirement of memory (thats not the end actually. There are still other things occupying memory but this is the major chunk).

And the problem is it needs everything in the memory to get the best features within the window which can discriminate between the positives and negatives such that most of the positives are correctly classified (currentDetectionRate > minHitRate is achieved) and very little amount of negatives are mis-classified (currentFalseAlarmRate < maxFalseAlarmRate is achieved) and a suitable threshold is set such that all conditions are satisfied in that stage and continues to the next stage till global requirements are met. That's the naive definition for the working of cascade classification. It continues adding features to the stage so that the defined Rates are achieved and moves on to the next stage. The training stops if defined maxFalseAlarmaRate ^ numStages is achieved before required stages. (In your case, for numstages = 200 for minFA = 0.5, its 10^-61) or numstages is reached.

And well, the following is obvious. You test your classifier. It slides a defined window(533 x 117 in your case) and looks at the location defined by the stage classifier, computes HAAR, > stage threshold ? test next stage : reject the window and slide to the next position and blah blah blah. It is all coded up in the facedetect.cpp in samples/c and you just have to call it by giving the cascade name.

Phew, that was long. Hope I didnt go wrong in the middle. (Please edit it if I have)

Things to note - Use small sample size for creating samples. Try LBP and HOG too. Go through that tutorial above (read it completely atleast once. Note: It is written for HAARTRAINING,the old buddy before traincascade. Make sure you take care of the changes). You must also not forget ... (more)