Effacer les filtres
Effacer les filtres

Imcrop in wit specified dimension

1 vue (au cours des 30 derniers jours)
valerio auricchio
valerio auricchio le 6 Oct 2020
Modifié(e) : Ameer Hamza le 6 Oct 2020
I was wondering if through imcrop it was possible to create squares of fixed size

Réponses (1)

Ameer Hamza
Ameer Hamza le 6 Oct 2020
Modifié(e) : Ameer Hamza le 6 Oct 2020
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);

Catégories

En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by