I was wondering if through imcrop it was possible to create squares of fixed size

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 6일
편집: Ameer Hamza 2020년 10월 6일

0 개 추천

Try this. It divides the image into square blocks of blk_size x blk_size pixels and save them in a cell array.
img = imread('pears.png');
blk_size = 100;
sz = ceil(size(img, [1 2])/blk_size)*blk_size;
img = padarray(img, sz-size(img,[1 2]), 0, 'post');
img_blks = mat2cell(img, blk_size*ones(size(img,1)/blk_size,1), blk_size*ones(size(img,2)/blk_size,1), 3);

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 10월 6일

편집:

2020년 10월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by