How to handle 100 binary images with a single matrix?
Show older comments
My folder consists of 100 binary images. I want to divide each of these images into some parts and want to calculate area of each block and want to store it in a matrix. Later that matrix I want to map to excel sheet I mean to say that I want to write these values to excel sheet. How to implement this repeated process so that 100 images each blocks area value will be stored in a matrix.
Accepted Answer
More Answers (1)
Image Analyst
on 9 Apr 2018
0 votes
Use blockproc() in a loop over all images.
4 Comments
Zara Khan
on 10 Apr 2018
Image Analyst
on 10 Apr 2018
For 4 areas, the area of each quadrant is numel(binaryImage)/4.
If you divide it into 8, the area is numel(binaryImage)/8 pixels.
For one image, you could of course store all the quadrant areas into one matrix.
areas4 = numel(binaryImage)/4 * ones(1, 4);
areas8 = numel(binaryImage)/8 * ones(1, 8);
If you want the foreground area of the binary image rather than the area of the image, you'll have to sum each quadrant
q1 = binaryImage(1:rows/2, 1:columns/2);
q2 = binaryImage(1:rows/2, columns/2:end);
q3 = binaryImage(rows/2:end, 1:columns/2);
q4 = binaryImage(rows/2:end, columns/2:end);
area1 = sum(q1(:));
area2 = sum(q2(:));
area3 = sum(q3(:));
area4 = sum(q4(:));
Zara Khan
on 11 Apr 2018
Zara Khan
on 12 Apr 2018
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!