What is wrong in this code .... !
Hi
I used the code below to raed a histogram image stored in an two dim. array to detmine the peaks of the histogram or in other words (the tallest rows in the array) but I faced a wrong results. Why ? I couldnt figure out why . Help me plz .
Thanks in advance
List tallestList =new ArrayList();
int numColoredRows = 0;
int tempTallestIndex = -1;
int tempTallestNum = 0;
List listA =new ArrayList();
List listB =new ArrayList();
listA.add(new Integer (0));
for(int rowIndex = 0 ; rowIndex < twoDim.length; rowIndex++){
// The current row to examine.
int[] row = twoDim[rowIndex];
// Count the number of (concatenated) colored pixels
// from the current row.
int numColoredPixels = numColoredPixelsInRow(row);
if(numColoredPixels > 0) numColoredRows++;
if(numColoredPixels > tempTallestNum)
{
tempTallestNum = numColoredPixels;
tempTallestIndex = rowIndex;
}
if(numColoredRows > 1 && (rowIndex == twoDim.length-1 ||
numColoredPixels == 0))
{
tallestList.add(new Integer(tempTallestIndex));
// listA.add(new Integer(tempTallestIndex));
}
if(numColoredPixels == 0)
{
numColoredRows = 0;
tempTallestIndex = -1;
tempTallestNum = 0;
}
}
System.out.println("List tallestList: " + tallestList);

