MATLAB: How to count the white pixels for each column in a binary image

binarycodeMATLAB

l.PNG

Best Answer

I = imread('download.png') ;
I = rgb2gray(I) ;
idx = I~=0 ;
iwant = sum(idx)