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!