필터 지우기
필터 지우기

Error with Imresize as a result of one image file not being in binary

조회 수: 3 (최근 30일)
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021년 5월 17일
답변: DGM 2021년 5월 17일
Hey all! So I'm calculating a metric (AUC_Borji to be specific) which makes use of a saliency map and a fixation map. According to the original source code, the fixation map is recommended to be in the form of a binary map. When I run the code normally without any of the inputs being in the form of a binary map, I get the following error:
Function IMRESIZE expected input number 2, MAP, to be a valid colormap. Valid
colormaps cannot have values outside the range [0,1].
The error is with respect to this particular line of the code:
if size(saliencyMap, 1)~=size(fixationMap, 1) || size(saliencyMap, 2)~=size(fixationMap, 2)
saliencyMap = imresize(saliencyMap, size(fixationMap))
end
The thing is that when I convert the 'input number 2' i.e fixationMap into a binary map through 'imbinarize', it still gives the above error. What is the problem with the above code plus is there a better way to binarize the image. For reference, the saliency map is 305x539x3 uint8, while the fixation map is 530x673x3 uint8

답변 (1개)

DGM
DGM 2021년 5월 17일
You're using imresize with a completely invalid syntax. Neither of these is an indexed color image or colormap in the sense that imresize() or any IPT tool would expect. A colormap is a simple 2D mx3 matrix.
You're trying to adjust one image to match the geometry of another. If you want image A to inherit the geometry of image B:
s = size(B);
A = imresize(A,s(1:2));
You may want to specify the interpolation method explicitly depending on what you want for your data.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by