Error with Imresize as a result of one image file not being in binary
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!