Extract multiple images from a single image

조회 수: 8 (최근 30일)
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE 2019년 2월 19일
댓글: MD RESHAD UL HOQUE 2019년 2월 19일
I have a big image (3064x7535x3). I need to crop multiple images ( as many as possible) with the size of 218x178x3 from that single image and save those image in .jpg on a forder.
I could not figure it out how to do it. Any suggestion?
Thanks
  댓글 수: 3
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE 2019년 2월 19일
There is no restrictions ...
Walter Roberson
Walter Roberson 2019년 2월 19일
So to confirm, you want to output
BigImage(1:218, 1:178, 1:3)
and
BigImage(2:219, 1:178, 1:3)
and
BigImage(1:218, 2:179, 1:3)
and so on? If so, if every consecutive subset of the appropriate size is to be output, then you will have 2847 x 7358 = 20948226 different output images to write to files.

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 2월 19일
C = mat2cell(YourBigImage(1:3052, 7476,:), 218*ones(1,4), 178*ones(1,42), 3);
Now C will be a 4 * 42 cell array, each entry of which is a non-overlapping sub-image from the original array. You can then save each of those 168 images to an individual file. You will have to decide on the naming convention for the file, though.
  댓글 수: 1
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE 2019년 2월 19일
I follow your code suggestion. But got this error.
I attached the screenshort of error message.
problm.png

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

카테고리

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