Clear Filters
Clear Filters

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 view (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 22 Jan 2018
You have the block so just pass it into histogram()
h = histogram(Block(:,:,k+j));
  5 Comments
Image Analyst
Image Analyst on 23 Jan 2018
Please define compare mathematically. Do you mean the delta E (color difference), the MSE in RGB space, or what?
teja jayavarapu
teja jayavarapu on 23 Jan 2018
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)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!