how to breaks image in to pixel

6 vues (au cours des 30 derniers jours)
image-pro
image-pro le 19 Oct 2021
infilename = 'C:/Users/DELL/Downloads/brains1.png';
Height=8; width=8;
currentimage = imread(infilename);
[r,c,~]=size( currentimage );
[~, currentfilename, ~] = fileparts(infilename);
for i=0:Height:r
ridx = floor(i/Height) + 1;
for j=0:width:c
cidx = floor(j/width) + 1;
if((i+Height)<r && (j+width)<c)
Image=imcrop(currentimage ,[(i+1) (j+1) Height width]);
outfilename = sprintf('%s_%03d_%03d.tif', currentfilename, ridx, cidx);
imwrite(Image, outfilename);
end
end
end
  3 commentaires
KSSV
KSSV le 19 Oct 2021
Modifié(e) : KSSV le 19 Oct 2021
Specify the error.
After looking at your code, I feel you should read about blocproc.
image-pro
image-pro le 19 Oct 2021
'imcrop' requires Image Processing Toolbox.

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 19 Oct 2021
Instead of imcrop() you can use indexing:
Image= currentimage((j+1) : (j+Height), (i+1) : (i+width));

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by