Detect black pixel horizontal edge and measure area under it.
Ältere Kommentare anzeigen
I am trying to write a script to automatically read the water level off a gauge from time lapse images. I have got the following script to:- 1) load image 2) rotate so gauge is horizontal 3) crop so only gauge is left in image 4) threshold it so it is black and white (gauge numbers and markings black, water black and gauge background is white)
The result of this code is the image below.

"I = imread('C:\Timelapse\test files\IMAG0471.jpg'); figure('name','Original'), imshow(I)
Ir = imrotate(I,10); figure('name','rotated'), imshow (Ir)
cropped = imcrop (Ir, [2325 450 45 800]); figure('name','cropped'), imshow (cropped)
thresh = 50; gauge = im2bw (cropped,thresh/255); figure('name','Thresh'),imshow(gauge)"
I have spent a long time trying to work out how to get matlab to detect the horizontal extent of the large black area. Once I have this value it should be quite straight forward I imagine to relate the area/size/length of black to different depths.
I would really appreciate any help and thank you very much for your time.
Akzeptierte Antwort
Weitere Antworten (1)
David
am 14 Feb. 2014
0 Stimmen
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!