Multiple image thresholding and measure distance
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
DGM
2023-11-16
编辑:DGM
2023-11-16
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 个评论
Image Analyst
2023-11-16
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 个评论
Image Analyst
2023-11-19
编辑:Image Analyst
2023-11-19
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!