MATLAB code error...

조회 수: 18 (최근 30일)
재호
재호 2025년 8월 26일 0:46
편집: Walter Roberson 2025년 8월 26일 7:33
Hello
I'm running a Matlab code related to quantifying the sphericity of soil particles.
Now I'm using MATLAB R2022a version
please check for errors
This code was made in 2016.
Thanks
  댓글 수: 1
Image Analyst
Image Analyst 2025년 8월 26일 3:54
Can you attach the tif file so I can determine why it has 4 planes? Aso attach your m-file so I can try it. Is it supposed to be an RGB true color image, or a volumetric image? Or an RGB image with an alpha channel? If it's a volumetric image, you should use bwlabeln instead of bwlabel.

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

답변 (1개)

Walter Roberson
Walter Roberson 2025년 8월 26일 2:37
편집: Walter Roberson 2025년 8월 26일 7:33
imbinarize() treats 3D arrays as being volumes. imbinarize() is not suitable for converting RGB images to binary.
To convert RGB images to binary, you should first use im2gray (R2020a or later), or rgb2gray
Note that TIFF images with 4 panes can be either RGBA or CMYK. To read RGBA images you should be using something like
[img, map, alpha] = imread('filename.tif');
If img comes out with three panes and map is empty and alpha is non-empty, then the file was RGBA.
If img comes out with four panes and map is empty and alpha is empty, then the file was CMYK.
There is another possibility: if the TIFF file is RGBIr (RBG plus infrared), then sometimes it will be written (incorrectly) as RGBA. RGBIr TIFF images should instead be constructed as RGB plus a seperate data pane (that will not be read by imread())

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by