how to breaks image in to pixel
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
image-pro
am 19 Okt. 2021
Beantwortet: Image Analyst
am 19 Okt. 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 Kommentare
Akzeptierte Antwort
Image Analyst
am 19 Okt. 2021
Instead of imcrop() you can use indexing:
Image= currentimage((j+1) : (j+Height), (i+1) : (i+width));
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!