Dividing a binary image into 8x8(64) blocks and storing no of black points in each block into an 8x8 matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to divide a binary image into 8x8(64) blocks. Then I need to count the no. of black points in each block and stored them into an 8x8 matrix. My image has the size of 120x120. Please help me to do this.
댓글 수: 1
답변 (3개)
Image Analyst
2015년 7월 11일
Simply define a function to count zeros:
ZeroCounterFunction = @(theBlockStructure) sum(theBlockStructure.data(:) == 0);
Then call blockproc():
blockSize = [8 8];
blockyImage8 = blockproc(grayImage, blockSize, ZeroCounterFunction);
Attached is a full demo that will create this image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177666/image.jpeg)
댓글 수: 2
bio lim
2015년 7월 12일
If the answers helped you, you should accept the answer that helped you the most.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!