필터 지우기
필터 지우기

Divide an Image of an Arbitrary Size Into 512 * 512 Blocks

조회 수: 1 (최근 30일)
Nour Aburaed
Nour Aburaed 2018년 6월 27일
답변: Image Analyst 2018년 6월 27일
Hello Everyone. This is my first time posting a question here, I will try to explain as best as I can (sorry for the not-so-good English lol).
I have an image of size 11772 x 11396. I want to divide it into 512 x 512 non-overlapping blocks. I tried to use reshape(img, 512, 512, []), but it gave me an error that basically means the number of pixels in the original image is not divisible by 512. What is the best way to overcome this problem?
This is the exact error message (in case it is needed): Error using reshape Product of known dimensions, 262144, not divisible into total number of elements, 134153712.
Thanks.

채택된 답변

Image Analyst
Image Analyst 2018년 6월 27일

추가 답변 (1개)

KSSV
KSSV 2018년 6월 27일
  댓글 수: 2
Nour Aburaed
Nour Aburaed 2018년 6월 27일
It doesn't seem relevant to my question because 32 x 32 is divisible by 4, they can be easily reduced to 8x8 blocks. My problem is that the number of pixels in my original image is not divisible by 512.
KSSV
KSSV 2018년 6월 27일
Use imresize and change the dimensions so that, they are divisible by 512.

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by