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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by