I have the following images (in high resolution, uncompressed). When the process starts, the left image is displayed and it ends something similar to the right image.
The first image shows labyrinth-kind-of strucutres with sometimes only bright borders, sometimes dark borders and sometimes both. The second, middle image shows the transition to the last image: The lines are getting shorter and disconnect. In the end nearly all of the lines will be gone and little circles will be present.
My goal is to detect the transition from lines to blobs, so basically the center image. I need to know when the lines are vanishing or when the blobs are appearing (let's say there are more than 5). The detection doesn't have to be super precise, I just want roughly to know when the first bubbles start coming. Also the detection should be as fast as possible.
What I have tried so far
I am very new to signal processing, so I'm not very sure how to start. I am using python.
My own solution (doesn't work)
In my naive way I thought "These contrasts should be easy to detect.". So I played around with blurring the image a little bit (to remove noise, even though there is very few noise) and then comparing each pixel value to a threshold. I encountered three problems:
- There is a (varying) gradient in the background.
- The contrast of the top left lines compared to their environment is a different than the contrast of the lines on the bottom right (because of the gradient)
- The lines are bright or dark
I then tried to somehow get the "local" contrast, so to compare the pixel value to the pixels around. I created a mask that selects only parts of the image, but this was (in my implementation) super slow. So I stopped with this way.
In addition I think it is harder to detect vanishing lines than appearing bubbles (?).
I found a blob detection page on scikit-image.org. I tried to use their algorithm and it is pretty good. I get the following result:
I used the transition image (the middle one of the top three images). The Difference Of Gaussian seems like what I want. But it is still detecting bigger "blobs" as you can see on the bottom right of the image wich I don't want. Also I'm not sure if this is the "default way to go" or if there are a lot better things which I'm just not thinking of.
Edit: The blob detection is very slow on my original data. So this is not an option except it can be speeded up a lot.
Canny edge detector
I tried to use the canny edge detector method as mentioned in the comments. But after some trying around I didn't get any good results. I end up with either way too much edges or no edges. Even after playing around and trying to smooth the image before or subtract, divide or multiply a smoothed image. But that may also just be because I don't know exactly how to do this. Out of my very limited knowledge I would say that the contrast is not good enough. But I don't know how to fix that.
So, to conclude: What is the best method to detect those blobs? And maybe, in addition: Is there a best python module to use? And if so, which one is it?