How to divide square image into rectangle with different size?
Show older comments
Hi,
I want to divide an image with 256x256 pixels (x,y) dimensions into 8 parts of rectangle, using sequence {32,8,64,16,8,32,64,32}. Hence I try to code so I can read the horizontal (x) region first, and assigned it into n1,n2.n3,n4,n5,n6,n7,n8. But the code is having mistakes hence i did not know how to proceed. Besides when i apply the codes, how i want to assign the value of n1=32,n2=8 and according to the specific region i try to divide?
%Dividing square image into 8 parts according to the row of image in its
%coordinates
clc;clear;
Pic=imread('cameraman_256.png');
figure(1)
imshow(Pic);
size(Pic)
row=size(Pic,2)
column=size(Pic,1)
if row==(1:32)
n1=row
disp(n1)
elseif row==(33:40)
n2=row
disp(n2)
elseif row==(41:104)
n3=row;
disp(n3)
elseif row==(105:120)
n4=row;
disp(n4)
elseif row==(121:128)
n5=row;
disp(n5)
elseif row==(129:160)
n6=row;
disp(n6)
elseif row==(161:224)
n7=row;
disp(n7)
else row==(223:256)
n8=row;
disp(n8)
end
Accepted Answer
More Answers (0)
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!