Index exceeds matrix dimensions. Error in nv (line 21) R = BL(i,j,1);

1 回表示 (過去 30 日間)
vasantha malairamar
vasantha malairamar 2017 年 3 月 8 日
回答済み: KSSV 2017 年 3 月 8 日
a=imread('Fig1(a).jpg');
% re=imresize(a,[768 768]);
% [r,c,numberofpixels]=size(re);
J = imresize(a, [768 786]);
[r c]=size(J);
bs=8; % Block Size (32x32)
row=r/bs;
col=c/bs;
nob=row*col;
% Total number of 32x32 Blocks
% Dividing the image into 32x32 Blocks
kk=0;
l=0;
[F]=zeros(96,96);
%[B0]=zeros(32,32);
for i=1:row
for j=1:col
BL=J((i-1)*8+[1:8],(j-1)*8+[1:8],1:3);
figure,imshow(BL);
% imwrite(BL,'C:\Users\Admin\Desktop\sample\op.jpg');
R = BL(i,j,1);
G = BL(i,j,2);
B = BL(i,j,3);
% figure,imshow([R G B]);
d=[R G B];
disp(d);
end
end

回答 (1 件)

KSSV
KSSV 2017 年 3 月 8 日
Check the dimensions of BL, the loop is going out of bounds of BL.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by