Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Edited by matt77hias

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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/

Edited by sjhalayka

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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).

Edited by sjhalayka

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now