Subscript indices must either be real positive integers or logicals.

3 Ansichten (letzte 30 Tage)
Kiruba Raji.I
Kiruba Raji.I am 19 Aug. 2016
Bearbeitet: Image Analyst am 20 Aug. 2016
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 Kommentare
James Tursa
James Tursa am 19 Aug. 2016
This is difficult to read. Can you please format it with the { } Code button to make it readable?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 20 Aug. 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).

Image Analyst
Image Analyst am 20 Aug. 2016
Bearbeitet: Image Analyst am 20 Aug. 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?

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by