How to sum binary sub pixels from 150x150 pixels?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kh. Islam
el 4 de Ag. de 2016
Comentada: Kh. Islam
el 14 de Oct. de 2016
I have a binary image 150x150 pixels, I would like to divided into 4 part so 1st part pixel ration (X:Y) will be (1:75, 1:75) and 2nd part will be (1:75, 76:end) and 3rd will be (76:end, 1:75) and 4th will be (76:end, 76:end). Now I would like to calculate sum of 1st, 2nd, 3rd and 4th divided part.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155457/image.jpeg)
0 comentarios
Respuesta aceptada
Image Analyst
el 5 de Ag. de 2016
Another way:
upperLeftSum = sum(sum(binaryImage(1:75, 1:75)))
upperRightSum = sum(sum(binaryImage(1:75, 76:end)))
lowerLeftSum = sum(sum(binaryImage(76:end, 1:75)))
lowerRightSum = sum(sum(binaryImage(76:end, 76:end)))
Más respuestas (1)
Azzi Abdelmalek
el 4 de Ag. de 2016
Editada: Azzi Abdelmalek
el 4 de Ag. de 2016
A=randi([0 1],150) % Example
b=mat2cell(A,75*ones(2,1),75*ones(2,1))
out=cellfun(@(x) sum(x(:)),b)
If you have Image Processing toolbox
out=blockproc(A,[75,75],@(x) sum(x.data(:)))
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!