i have divided the image into blocks now, i want to access each block individually and i compute histogram how do i access each block

1 次查看(过去 30 天)
a=imread(img);
subplot(4,3,2)
imshow(img)
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0.05 1 0.95]);
[r, c, numOfBands] = size(a);
%dividing image into 8x8 subblocks
bs=8;%block size
nob=(r/bs)*(c/bs);%Total no of blocks
k=0;
for i=1:(r/bs)
for j=1:(c/bs)
Block(:,:,k+j)=a((bs*(i-1)+1:bs*(i-1)+bs),(bs*(j-1)+1:bs*(j-1)+bs));
end
k=k+(r/bs);
end

回答(1 个)

Image Analyst
Image Analyst 2018-1-22
You have the block so just pass it into histogram()
h = histogram(Block(:,:,k+j));
  5 个评论
teja jayavarapu
teja jayavarapu 2018-1-23
I know how to compare , but after diving image into blocks (suppose 32 blocks) how to acces each block block of an image to compare with respective block in the database(loaded with images)

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by