getHistogramHorizontal method
Returns the horizontal histogram of the matrix.
The histogram represents the number of true (or inked) cells
in each column of the matrix. The result is a list where each
index corresponds to a column, and the value at that index
represents the count of true values in that column.
Implementation
List<int> getHistogramHorizontal() {
final List<int> histogram = List.filled(cols, 0);
for (int x = 0; x < cols; x++) {
for (int y = 0; y < rows; y++) {
if (cellGet(x, y)) {
histogram[x]++;
}
}
}
return histogram;
}