필터 지우기
필터 지우기

how to breaks image in to pixel

조회 수: 1 (최근 30일)
image-pro
image-pro 2021년 10월 19일
답변: Image Analyst 2021년 10월 19일
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
KSSV
KSSV 2021년 10월 19일
편집: KSSV 2021년 10월 19일
Specify the error.
After looking at your code, I feel you should read about blocproc.
image-pro
image-pro 2021년 10월 19일
'imcrop' requires Image Processing Toolbox.

댓글을 달려면 로그인하십시오.

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by