Subscript indices must either be real positive integers or logicals.
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Error in imcut NewIm = Image( (cr - 63):(cr + 64),(cc - 63):(cc + 64) );
Error in pcn1 xo = imcut(xr); subplot(6, 3, 3*rt+9*(sc-1)-2), imshow(xo)
pcn1.m
clear,close all,
addpath('functions\');
addpath('images\')
x = imread('d:\segleaf\i1.jpg');
figure,
for sc =1:2
xs = imresize(x,0.2*sc+0.6);
for rt = 1:3
xr = imrotate(xs,rt*30-30,'bilinear','crop');
xo = imcut(xr);
subplot(6, 3, 3*rt+9*(sc-1)-2),
imshow(xo)
h = imhist(xo);
subplot(6, 3, 3*rt+9*(sc-1)-1),
plot(h), xlim([0, 256])
set(gca,'xtick',[],'xticklabel',[]);
set(gca,'ytick',[],'yticklabel',[]);
ts = SCM(xo);
subplot(6, 3, 3*rt+9*(sc-1)),
plot(ts),
ylim([0, 5000])
set(gca,'xtick',[],'xticklabel',[]);
set(gca,'ytick',[],'yticklabel',[]);
end
end
imcut.m
[r,c] = size(Image);
cc = floor(c/2);
cr = floor(r/2);
NewIm = Image( (cr - 63):(cr + 64),(cc - 63):(cc + 64) );
NewIm=logical(NewIm);
2 commentaires
James Tursa
le 19 Août 2016
This is difficult to read. Can you please format it with the { } Code button to make it readable?
Réponses (2)
Walter Roberson
le 20 Août 2016
You are reading a JPEG. That is highly likely an RGB image rather than a grayscale image. Using
[r,c] = size(Image);
for an RGB image is almost always a mistake.
[d1,d2,d3,...,dn] = size(X), for n > 1, returns the sizes of the dimensions of the array X in the variables d1,d2,d3,...,dn, provided the number of output arguments n equals ndims(X). If n does not equal ndims(X), the following exceptions hold:
n < ndims(X)
di equals the size of the ith dimension of X for 0<i<n, but dn equals the product of the sizes of the remaining dimensions of X, that is, dimensions n through ndims(X).
0 commentaires
Image Analyst
le 20 Août 2016
Modifié(e) : Image Analyst
le 20 Août 2016
It says you're doing this:
xo = imcut(xr);
Yet your definition of imcut in imcut.m does not have a function line so how are you going to pass in xr?
Also, see this on how to use size(): http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!