Distance bethween two regions
1 view (last 30 days)
Show older comments
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
Accepted Answer
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
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.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!