필터 지우기
필터 지우기

Errors in turbulent image analysis.

조회 수: 1 (최근 30일)
재훈
재훈 2024년 4월 26일
댓글: Image Analyst 2024년 5월 1일
Hello, I am analyzing images of turbulent for a school assignment.
The code below is the code I learned, but an error occurs at lines 5 and 11. Thank you for letting me know where I went wrong.
Thank you and have a good day:)
(Plus, I have attached a photo for analysis below.)
clc; clear all, close all;
I = imread('301.png');
I = rgb2gray(I);
I = I(120:840, 850:1320);%ERROR
Index in position 1 exceeds array bounds. Index must not exceed 720.
figure(1)
imshow(I);
title('original image');
[~,threshold] = edge(I,'sobel');%ERROR
fudgeFactor = 0.7;
BWs = edge(I,'sobel',threshold*fudgeFactor);
figure(2)
imshow(BWs);
Title('gradient');
se1 = streal('line',3,90);
se0 = streal('line',3,0);
BWsdil = imdilate(BWs,[se1 se0]);
figure(3)
imshow(Bwsdil);
figure(4)
imshow(labeloverlay(I,BWdil));

답변 (2개)

sai charan sampara
sai charan sampara 2024년 4월 26일
Hello,
The error in line 5 is probably because you are trying to access indices that are beyond the size of the image "I". You can correct this by checking the size of "I" after line 4 and then making sure that the indices in line 5 are always less than the x and y dimensions of "I". Correcting this should also remove the error in line 11.
Also, the function for morphological structuring element is "strel" and not "streal". The function to add title to an image is "title" and is case sensitive. The dilated image is named as "BWsdil" but in later lines used as "Bwsdil" and "BWdil" which are different from the original variable name. These also might lead to errors.
You can refer to the following documentation to learn more about morphological structuring element:
  댓글 수: 1
재훈
재훈 2024년 5월 1일
Now I know my problem! Thank you verry much. Have a good day!!

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2024년 4월 26일
편집: Image Analyst 2024년 4월 26일
The reason for the error is that your image does not have as many as 840 rows and 1320 columns.
Why are you even cropping the image? I see no need for that. Just take out this line:
I = I(120:840, 850:1320);%ERROR
or else use imcrop
Other than that there is still a lot wrong with your analysis. I would not do an edge detection. What I'd do is to take an image of the gas with no turbulence at all. Then divide your turbulent image by that image. This will flatten the background and then you can threshold the background to find pixels either brighter or darker than the background.
Alternatively (close but theoretically not as accurate as background division) is to do background subtraction using imabsdiff and then threshold to find pixels a little brighter than 0.
  댓글 수: 2
재훈
재훈 2024년 5월 1일
Oh I see! thank you verry much that help me. Have a good day, take care
Image Analyst
Image Analyst 2024년 5월 1일
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by