OpenCV

Started by
27 comments, last by sjhalayka 6 years, 4 months ago

Does anyone have experience with OpenCV? Did you buy any books? Were they helpful?

Advertisement

It's a very large, expansive library with many different pieces for many different things. IME the best thing to do is have a specific project in mind and pursue the information needed to do the specific tasks required to solve that project. You can't just learn OpenCV, as such, because it's too big and none of it really makes any sense without the context of trying to accomplish something.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

I'm basically wanting to write an app that detects dynamic obstacles.

OpenCV has beside a C++ API, a Python API as well. The latter can be more suitable for quick prototyping.

You probably want to search for edge detection utilities first.

As a side note, the domain of computer vision can be quite "messy" since there are lots of different approaches to the same problem, ranging from ad hoc to rather sophisticated, ranging between real-time and offline performance. So do not stick to one fixed approach in advance.

🧙

As far as books go, the O'Reilly's "Learning OpenCV 3.0" was a really good overview of the library. I read through the entire thing, they do a great job explaining the library, getting you set up and getting into it, and explaining the different parts of the library and overview how they work. They also do a really good job at getting you familiar with some of the techniques used in computer vision/image processing, such as feature detectors and descriptors.

If your new to OpenCV, you won't want to read straight through the entire book, you'll just waste time. Read through the first couple chapters to get how the library works, then sort of pick and choose the chapters that are relevant to what your trying to do. Definitely worth purchasing if you want to learn OpenCV.

Thanks all. I am getting Learning OpenCV 3.0 as a gift. :)

Ok what I want is to do an edge detection, then convert all gray pixels to white or black, depending- on the darkness of the gray.

Then I want to do is draw a white bitmap to the entire screen, then draw the black edge pixels then do a fill that doesn’t permeate the black.

I should end up with a fill, and some white regions where the obstacles are.

Is it possible to do this in OpenCV? I know that it does edge detection.

So far I found this: https://www.learnopencv.com/filling-holes-in-an-image-using-opencv-python-c/

You may need to use a couple different techniques to get what you're after. But I think what your looking for is connected components. the first thing you'll do is load your image and convert it into a grayscale image using imread and cvtColor. then you use adaptive thresholding to turn the image to black and white, or black white and grey, using the function adaptiveThreshold. Then you can use the function findContours to find each "connected component" [another link]. findContours works best when your image has been thresholded, which is why i mentioned adaptive thresholding above. You can also do canny edge detection, but I've personally had better results with adaptive thresholding before findContours, although the actual results will depend a lot on what is actually in your images. You'll then be able to either draw the outlines of the contours or fill them in with either drawContours or fillPoly.

You'll probably find at some point you get better results by pre processing your image even more, for example either Eroding and Dilating

Anyway, that should get you started while you wait for your book

 

The code is posted at:

https://github.com/sjhalayka/obstacle_detection/blob/master/opencvtest.cpp

... it uses the AVI reading code from the book Learning OpenCV 3.

Some test AVIs are included in the repository at:

https://github.com/sjhalayka/obstacle_detection

Thanks for the insight.

I updated the code to detect the edges in the H channel from an HSV version of the input image. This works better than the original code, which detected the edges in the grayscale version of the input image. Edges can also be detected in the S and V channels; no point in throwing away good input data; the V channel is like the grayscale version of the input image.

Looking into more complicated obstacle detectors; machine learning (already found code to do the XOR operation using a feed-forward back-propagation artificial neural network -- the equivalent of Hello World LOL).

Does anyone have any experience with the bioinspired contrib module? I am trying to compile an example and it gives me the error 'createRetina' is not a member of cv::bioinspired.

Any idea? I can't seem to find it defined in any of the .hpp files.

This topic is closed to new replies.

Advertisement