how to divide an image into blocks

26 ビュー (過去 30 日間)
natasha malhothra
natasha malhothra 2015 年 6 月 16 日
編集済み: Walter Roberson 2017 年 2 月 10 日
an image shoud be divided into several blocks of 8 by 8 pixel
  4 件のコメント
ROSE MARY KATIKALA
ROSE MARY KATIKALA 2017 年 2 月 10 日
done but for road detection project i just need to make an image of 0's n 1's of roaads and non roads parts... how can i do that? can u give me a clear explanation.. im beginner in matlab so..
Walter Roberson
Walter Roberson 2017 年 2 月 10 日
You should open a new question for that, showing some sample images, and showing the work you have done.

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

採用された回答

Anushka
Anushka 2015 年 6 月 16 日
編集済み: Walter Roberson 2017 年 2 月 10 日
J = imresize(M1, [256 256]);
[r c]=size(J);
bs=32; % Block Size (32x32)
nob=64 % Total number of 32x32 Blocks
% Dividing the image into 32x32 Blocks
kk=0;
l=0;
[F]=zeros(1,64);
%[B0]=zeros(32,32);
for i=1:(r/bs)
for j=1:(c/bs)
B0=J((bs*(i-1)+1:bs*(i-1)+bs),(bs*(j-1)+1:bs*(j-1)+bs),3);
end
kk=kk+(r/bs);
end
% And to get the RGB values I used the following code
for x=1:32
for y=1:32
R=B0(x,y,1);
G=B0(x,y,2);
B=B0(x,y,3);
end
end

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 6 月 21 日
See my attached demos that demonstrate several ways to use blockproc().

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by