Subscript indices must either be real positive integers or logicals.

3 ビュー (過去 30 日間)
Kiruba Raji.I
Kiruba Raji.I 2016 年 8 月 19 日
編集済み: Image Analyst 2016 年 8 月 20 日
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 件のコメント
James Tursa
James Tursa 2016 年 8 月 19 日
This is difficult to read. Can you please format it with the { } Code button to make it readable?
per isakson
per isakson 2016 年 8 月 20 日
I cannot reproduce the problem you report. See Debug a MATLAB Program

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 8 月 20 日
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 2016 年 8 月 20 日
編集済み: Image Analyst 2016 年 8 月 20 日
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?

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by