respectively create two images one with lines and one with circles from source image.
I started with detecting contours in image to filter everything that may be circle from image which gives me results like this:
I'm new to computer vision and dealing with this specific task, so want thank you for any help and guidance.
Thank you all, here are some answers to questions from comments:
a good way to do it
Which techniques do you know that have something like that?
Today I looked at template matching, created a template for the black and white circle and localised them in an original image. Once I have this extracting lines is straightforward (just subtracting circles from the original image). This seems working well in the simplest scenario when circles are the same size as templates.
The more robust way I think will be to use Haar Cascade classifier, train it on different size circles, and continue as with results from template matching.
Correct me if there maybe a better way?
The main idea is to digitalize diagrams consisting of black and white circles connected by lines, The size of diagrams and quality of images may vary. Also, the circles may contain numbers (Extracting those is something for future)
The lines connecting circles are axis aligned, they define position of circles in diagram (similar to cartesian plane)
I mentioned Python (js) and OpenCV languages in case there are some specific implementation details I should be aware of. I'm also learning Python while doing this :).
I don't expect the solution or code, rather pushing to right direction and strategy to deal with this kind of problems.