Image Processing Distance Measurement

2 vues (au cours des 30 derniers jours)
Justin Blommer
Justin Blommer le 15 Oct 2019
I am a new user to the Image Processing Toolbox and need some help. I want to know if the following distance measurements are possible to make programmatically on the below attached image (manual measurements in ImageJ are very time-intensive).
Measurement 1: Width of the purple object
Measurement 2: Width of the black rectangle (there may be more than 1 in the image. Must be width of the one closest to the purple object.
Measurement 3: Horizontal distance from the bottom tip of the purple triangle to the farther away vertical edge of the black rectangle
Measurement 4: Vertical distance from the bottom tip of the purple triangle to the bottom edge of the black rectangle (white dotted reference line NOT part of original image)
The purple overlay is computer generated so will be mostly consistent from image to image but the black/grey is generated from a radiographic imaging so the black and/or grey may have slightly different pixel intensities between different images.
Thanks!

Réponses (1)

Image Analyst
Image Analyst le 15 Oct 2019
Try (untested)
% extracting the red channel
redChannel = rgbImage(:,:,1);
[rows, columns] = size(redChannel)
% then thresholding it
mask = redChannel > some value
% then taking the largest blob
mask = bwareafilt(mask, 1);
% then you might go down the image using sum() to get the width
widths = zeros(rows, 1)
for row = 1 : rows
thisRow = mask(row, :);
w = sum(thisRow)
widths(row) = sum(thisRow)
end
% Get rid of zero widths
widths(widths == 0) = [];
meanWidth = mean(widths)
See if you can get measurements 2, 3, and 4 on your own.

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by