Imcrop in wit specified dimension
1 回表示 (過去 30 日間)
古いコメントを表示
I was wondering if through imcrop it was possible to create squares of fixed size
0 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 10 月 6 日
編集済み: Ameer Hamza
2020 年 10 月 6 日
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);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!