Hello,
out of curiousity installing Scilab 2026 and the latest IPCV version I find that the help page for imread might benefit from a small update.
Especially the use of the different modes.
Current help page:
modes: imread mode to be specified for different image format
Just later down it is mentioned:
The imread mode can be controlled by setting any of these optional arguments to 1:
I wonder if it could be possible to move this information to the “modes” section.
Thats aside, it took me while a while to figure out that the optional argument IMREAD_ANYDEPTH
can be set not only to 1 (grayscale), but also 3 (RGB), 4 (RGBA).
This is not mentioned in the help page at all.
Indeed 2 is also possible, but it seem to give the same result as 3…in fact it seems that all integers are possible, even negative ones … -1 creates the same result as 4. Funny enoughIMREAD_ANYDEPTH= 10000 reduces the image size from 256x256 to 64x64
To play around with the settings, I use this script:
img = imread(fullpath(getIPCVpath()+"/images/puffin.png"),IMREAD_ANYDEPTH = 4);
[H W CH] = size(img)
f = figure();
f.figure_position = [20,20];
f.background = 8;
if(CH == 1)
f.figure_size = [400,411]
imshow(img);
a = gca();
a.x_label.text = "image";
else
f.figure_size = [1500,411];
subplot(1,CH+1,1)
imshow(img);
a = gca();
a.x_label.text = "image";
subplot(1,CH+1,2)
imshow(img(:,:,1));
a = gca();
a.x_label.text = "R";
subplot(1,CH+1,3)
imshow(img(:,:,2));
a = gca();
a.x_label.text = "G";
subplot(1,CH+1,4)
imshow(img(:,:,3));
a = gca();
a.x_label.text = "B";
if(CH==4)
subplot(1,CH+1,5)
imshow(img(:,:,4));
a = gca();
a.x_label.text = "A"
end
end
Cheers, Philipp