Error using montage function
I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10.I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10. I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10. montage, image processing, matlab function MATLAB Answers — New Questions