Changeset 12092 for trunk/FACT++
- Timestamp:
- 09/13/11 15:07:20 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r12079 r12092 376 376 ostringstream str; 377 377 float min, max, median; 378 min = max = fData[0]; 378 int ii=0; 379 for (;ii<ACTUAL_NUM_PIXELS;ii++) 380 { 381 if (finite(fData[ii])) 382 { 383 min = max = fData[ii]; 384 break; 385 } 386 } 379 387 double mean = 0; 380 388 double rms = 0; 381 389 median = 0; 382 // multiset<double> medianSet; 390 if (ii==ACTUAL_NUM_PIXELS) 391 { 392 fmin = fmax = fmean = frms = fmedian = 0; 393 return; 394 } 395 383 396 vector<double> medianVec; 384 397 medianVec.resize(ACTUAL_NUM_PIXELS); 385 398 auto it = medianVec.begin(); 399 int numSamples = 0; 386 400 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 387 401 { 402 if (!finite(fData[i])) 403 continue; 388 404 if (fData[i] < min) 389 405 min = fData[i]; … … 395 411 *it = fData[i]; 396 412 it++; 413 numSamples++; 397 414 } 398 415 … … 404 421 // iii++; 405 422 // } 406 sort(medianVec.begin(), medianVec. end());407 408 409 mean /= ACTUAL_NUM_PIXELS;410 rms = sqrt( rms/ACTUAL_NUM_PIXELS - mean * mean);423 sort(medianVec.begin(), medianVec.begin()+numSamples); 424 425 426 mean /= numSamples; 427 rms = sqrt((rms/numSamples) - (mean * mean)); 411 428 412 429 // multiset<double>::iterator it = medianSet.begin(); 413 430 auto jt = medianVec.begin(); 414 for (int i=0;i<( ACTUAL_NUM_PIXELS/2)-1;i++)431 for (int i=0;i<(numSamples/2)-1;i++) 415 432 { 416 433 // it++; … … 419 436 median = *jt; 420 437 // cout << *it << " " << *jt << endl; 438 if (numSamples%2==0){ 421 439 jt++; 422 440 median += *jt; 423 median /= 2; 441 median /= 2;} 424 442 425 443 str << "Min: " << min << endl << " Max: " << max << " Mean: " << mean << " RMS: " << rms << " Median: " << median; -
trunk/FACT++/gui/QCameraWidget.cc
r12080 r12092 310 310 double dmin = fData[0]; 311 311 double dmax = fData[0]; 312 for (int ii=0;ii<ACTUAL_NUM_PIXELS;ii++) 313 { 314 if (finite(fData[ii])) 315 { 316 dmin = dmax = fData[ii]; 317 break; 318 } 319 } 312 320 if (fMin < fScaleLimit || fMax < fScaleLimit) 313 321 { 314 322 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 315 323 { 324 if (!finite(fData[i])) continue; 316 325 if (!fEnable[i]) continue; 317 326 if (fData[i] > dmax) dmax = fData[i]; … … 325 334 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 326 335 { 327 if (!fEnable[i] )336 if (!fEnable[i] || !finite(fData[i])) 328 337 { 329 338 // cout << "not enabled !" << i << endl;
Note:
See TracChangeset
for help on using the changeset viewer.