Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to split and store it into one arrray?
조회 수: 1 (최근 30일)
이전 댓글 표시
hello.. i'm trying to split image into block 8x8, then extract the pixel values from each block. i want to move position of blocks. then store it back into 1 array..how do i get it?sorry, i am newbie thanks
댓글 수: 0
답변 (1개)
David Sanchez
2013년 7월 15일
I = your_image;
[rows,cols] = size(I); % dimensions of your image
M = cell(8,8);
for k=1:8
for l = 1:8
M{k,l} = I( (rows*(k-1)/8 + 1):(rows*k/8) , (cols*(l-1)/8 +1):(cols*l/8) );
M{k,l} = reshape8M{k,l},(rows*cols/64),1); % reshape into single column
end
end
댓글 수: 2
David Sanchez
2013년 7월 15일
here with the typo in the 7th line corrected:
I = your_image;
[rows,cols] = size(I); % dimensions of your image
for k=1:8
for l = 1:8
M{k,l} = I( (rows*(k-1)/8 + 1):(rows*k/8) , (cols*(l-1)/8 +1):(cols*l/8) );
M{k,l} = reshape(M{k,l},(rows*cols/64),1); % reshape into single column
end
end
Jan
2013년 7월 15일
@David: You can edit your question instead of adding a comment with a corrected version.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!