Multiple image thresholding and measure distance
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I am measuring flame heights from images, extracted from vdo clip. I can do threshold to remove background and set a scale virtually to measure flame height. But is there any code or way to measure multiple images thresholding and heights? i need this help very much. I have 6000 images in one vdo. It will take long doing one by one. Height of the frame is 120 cm, all images are cropped in one size. Can i get the height somehow mesuring the pixel value?
0 commentaires
Réponses (2)
DGM
le 16 Nov 2023
Modifié(e) : DGM
le 16 Nov 2023
Nothing is going to be able to automatically read the background scale from an image like that. It's also not exactly square or flat. If the images are consistently fixed with respect to the background scale, you can just create some sort of calibration information one way or another. If the images move with respect to the background scale, then all bets are off.
I just manually guessed where the scale lines were and created an annotated copy of the image to use as a reference.
% GET THE REFERENCE GRID %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the annotated image
annotated = imread('TA.png');
% create and filter mask to find grid lines
lmk = annotated(:,:,1) < 5;
lmk = bwareafilt(lmk,12);
lmk = bwskel(lmk);
% sample lines near L and R image edges
% length of cm0 and y0 vectors should match
ycm0 = 120:-10:10;
x0 = [5 size(lmk,2)-5];
yL0 = find(lmk(:,x0(1)));
yR0 = find(lmk(:,x0(2)));
% PROCESS A TEST IMAGE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the test image
inpict = imread('Top.png');
inpict = im2gray(inpict);
% do some sort of binarization
mask = imbinarize(inpict);
imshow(mask,'border','tight')
% find the column and row of the leftmost pixel of the top row
[x,y] = find(mask.',1);
% use the annotations to find the position using quasi-2D interpolation
% this is a quick and adequate way to deal with sparse half-gridded samples
% where extrapolation is (probably) needed
ycmL = interp1(yL0,ycm0.',y,'linear','extrap');
ycmR = interp1(yR0,ycm0.',y,'linear','extrap');
ycm = interp1(x0,[ycmL ycmR],x,'linear','extrap')
0 commentaires
Image Analyst
le 16 Nov 2023
See attached demos where I read frames from a video and then process them. You could make the obvious adaptations, such as the name(s) of the video, replacing taking the mean by thresholding like @DGM (or it might be better to use a fixed threshold), etc.
4 commentaires
Image Analyst
le 19 Nov 2023
Modifié(e) : Image Analyst
le 19 Nov 2023
Again, you probably don't need the stuff about computing and plotting the mean. And the index should be frame, not frameNumber in
topRow(frameNumber) = min(whiteRows)
Voir également
Catégories
En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!