edge detection and selection with with brightness differences

48 Views Asked by At

I have a liquid bow wave that is recorded by a high-speed camera. This gives me a lot of images that I want to analyze automatically. I want to determine the outer contour of the liquid and preferably extract the coordinates of the individual pixels. Image to be analyzed Edge that I would ideally like to have

When using edge detection like canny, I run into the problem that there is an edge at the top that is caused by the drop in brightness of the lighting. Furthermore, I don't know how to delete the small edges and keep only the "main edge" for further evaluation.

Canny edges

2

There are 2 best solutions below

0
Sebastian_Ulrich On

To get rid of the small edges you can try to Erode an Dilate. By doing this the small gaps on the left will be filled and no edges may be found there anymore. Also you could search for the longest found edge. By combining these two approaches you should be able to resolve this problem. For more information:

https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html

For the top edge problem i have a few ideas you could try:

  1. Imporving the ligthning situation:
    • this would be the solution with the best result, but may not be physically/economically/... feasable
  2. Cropping the image to only inpsect well ligthed part
    • Maybe you are only interested in the peak of the wave. Then cropping the image would be a good solution
  3. Look for other Variables instead of brightness
    • Maybe you find a color channel or some Channel in the HUE color space in which the edge of the wave is better sperated
0
Pam On

Sebastian_Ulrich's answer gives a good overview of processing the Canny edge image, but do consider what you can do to the image extraction prior to Canny extraction:

  • You mention it's a series of images and you want to extract a moving bow wave from them. Do all the images have a reasonably consistent lighting pattern? Can you perform some sort of background subtraction? Be warned that this might not work with some kinds of lighting (things that look steady to our eyes sometimes strobe to high speed cameras). OpenCV has a few different methods for background subtraction. It might be easier to clean up the background subtracted images than it is to process the raw images.

  • The wave runs top to bottom. Is it possible you could use segmentation to extract the wave? Again OpenCV has different kinds of segmentation. Think about segmenting the image into pixels-that-are-wave (black) and pixels-that-are-background (white). A straightforward Otsu's threshold or other image thresholding might help.

  • Clean up the image with histogram equalisation. CLAHE is used a lot in water-based images, so might be suitable here. Although once you've used it, you might find some of the noisy edges have actually been enhanced, in which case you might have to change the CLAHE parameters or blur (Gaussian blur) and re-sharpen the image (same as dilate and erode).

  • If you go for segmentation, then maybe use OpenCV's contour extraction to find the contour that represents the "edge" of the wave. That should give you a list of the x,y co-ordinates that make up the edge.