MATLAB: Image Projections Kavalieratou.

kavallieratou projections

Hi Guys! I have a problem on Structural Characteristics(kavallieratou) technique. Well, i'm implementing this method on matlab for a research, but i'm really new on matlab.(never programed in, never. Only java, but my research needs matlab). I'm have a trouble on step of the projections( horizontal projections, Vertical projections and principally radial projections and profiles(in-out, out -in). In kavallieratou, these steps are necessary to analyze it, and after puts all of them in a vector with 280 characteristics. Going deeper, this technique is to count the black pixels of a row / column, and stores in a vector. The radial projection is calculated by sum of black pixels in the image from the center Geometric image and moving toward the edge pre-defined angles.I just need it for make a comparation with another technics, and i implemented all of others steps but this step i dont know how to do on matlab. Any one knows it?
thanks in advance!

Best Answer

To "count the black pixels of a row / column, and stores in a vector." you'd do this
[rows columns] = size(grayScaleImage);
countOfNonZerosInARow = zeros(1, rows);
countOfNonZerosInAColumn= zeros(1, columns);
for row = 1 : rows
oneRow = grayScaleImage(row, :);
countOfNonZerosInARow(row) = nnz(oneRow);
end
for column = 1 : columns
oneColumn = grayScaleImage(:, column);
countOfNonZerosInAColumn(column) = nnz(oneColumn);
end
There are other ways, but this might be the most straightforward for a beginner like you. Can you handle it from there?