How can I find the difference in height between the two manometer's limbs using image processing?

2 views (last 30 days)
I am taking measurements of manometer from a video, and I want to take each frame and find the difference in height between the two limbs as shown in the photo. Then clculate the arithmetic mean for al the measurements.
here is my attempt to solve the problem:
My main focus is on the curved top of the liquid as it is darker than the liquid itself and the measurements are taken from the bottom of this curve.
First I crop the Image to get rid of the unnecessary region, then I convert it to binary as shown next
the next step is using:
bwlabel() %to label every white region
label2rgb() %to convert back to RGB image
and the result is this:
Finally keeping only the wanted regions (the top of the liquid in each tube) using their colors (orange and pink) in the previous image.
As I mentioned above, I am taking the measurements from a video (about 300 frames), the problem is that in each frame the colors differs slightly, I managed to specify a range for each color, but I believe that there is a better way to do this. Especially since I want to extract information from 200 similar videos, so the code should be able to determine the height automatically,
The main problem with my approch is that the colors of the regions (after applying bwleabel() and then label2rgb() ) change in each frame and of course this difference will be even greater when applied to frames from another video.
I think the best way to do this is to identify the concave top of the liquid very accurately and in a way that is not affected by changes from one video to another.
I know this is a difficult task that I wouldn't hope you would help me in the best way. I can also take advantage of what you think about the steps I've taken.
Thanks in advanced.

Answers (1)

Image Analyst
Image Analyst on 12 Aug 2022
Garbage in, garbage out. First of all try to improve your image capture.
  1. Get rid of the blue lines. Try a uniform background like black or white velvet fabric.
  2. Then use polarizers to get rid of specular reflections.
  3. Then have the tubes in a jig with a fixed camera so that you're always looking at the same columns of the image every time.
  4. Take vertical profiles using mean(grayImage(row1:row2, col1:col2, 1) to get the mean profile along the box that is just inside the tube.
  5. Then analyze that profile to try to determine where the liquid/air interface is.
Once you have better images, we can talk more. No sense in continuing when you're using these really bad images.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!