Hi, I'm trying to get the peak for a bimodal histogram. Here is the code and i just could not filter the last two
int number=0; int size=0; for (int i=1; i<256-1;++i) { if(histoheight[i]>histoheight[i-1] && histoheight[i]>histoheight[i+1]) { cout << "Peak Index: " <
Output: Peak Index: 133 Peak Value: 40 Peak Index: 143 Peak Value: 318 Peak Index: 145 Peak Value: 373 Peak Index: 147 Peak Value: 400 Peak Index: 150 Peak Value: 306 Peak Index: 152 Peak Value: 238 Peak Index: 159 Peak Value: 87 Peak Index: 163 Peak Value: 49 Peak Index: 166 Peak Value: 39 Peak Index: 168 Peak Value: 40 Peak Index: 172 Peak Value: 20 Peak Index: 174 Peak Value: 17 Peak Index: 176 Peak Value: 15 Peak Index: 178 Peak Value: 14 Peak Index: 181 Peak Value: 12 Peak Index: 186 Peak Value: 10 Peak Index: 198 Peak Value: 11 Peak Index: 207 Peak Value: 9 Peak Index: 211 Peak Value: 9 Peak Index: 221 Peak Value: 9 Peak Index: 228 Peak Value: 10 Peak Index: 233 Peak Value: 11 Peak Index: 235 Peak Value: 12 Peak Index: 242 Peak Value: 16 Peak Index: 250 Peak Value: 18
The two peak is there where the condition are 1) when Peak Index is the smallest and Peak Value is the highest 2) when Peak Index is the highest and Peak Value is the highest
How to include this in the code? Thanks for the help