Distance bethween two regions

1 view (last 30 days)
Good evening, I have to measure the distance between the two regions, as shown in the image, in a sequence of 1800 frames in succession. The distance varies frames by frames. I have difficulty in finding the minimum distance between these two. I enclose a picture type. thank you very much
  4 Comments
Ektor Lucci
Ektor Lucci on 18 Sep 2013
in the picture I have used the imdistline. I have to create a loop to make sure that detects the distance between the two white regions in an automatic way.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 18 Sep 2013
Try this:
% Get a thick band of pixels
band = grayImage(42:68, :);
% Get the mean horizontal profile by
% averaging along rows within each column.
horizontalProfile = mean(band, 1);
% Threshold to find dark area
darkPixels = horizontalProfile < 128' % Or whatever value...
% Find starting column
startingColumn = find(darkPixels, 1, 'first');
% Find ending column
endingColumn = find(darkPixels, 1, 'last');
  2 Comments
Ektor Lucci
Ektor Lucci on 18 Sep 2013
can you send me a loop for 10 images as an example?
Image Analyst
Image Analyst on 18 Sep 2013
Sure! Code for that is here in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F. Just copy, paste, and make slight adaptations.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!