FACT++  1.0
void QCameraWidget::CalculatePixelsColor ( )
private

Definition at line 339 of file QCameraWidget.cc.

References ACTUAL_NUM_PIXELS, BasicGlCamera::bb, CalculatePatchColor(), color(), BasicGlCamera::fData, fEnable, BasicGlCamera::fMax, BasicGlCamera::fMin, BasicGlCamera::fScaleLimit, BasicGlCamera::gg, i, BasicGlCamera::logScale, BasicGlCamera::pixelColorUpToDate, BasicGlCamera::pixelsColor, BasicGlCamera::rr, BasicGlCamera::ss, BasicGlCamera::tooHighValueCoulour, BasicGlCamera::tooLowValueCoulour, and BasicGlCamera::UpdateText().

Referenced by drawCamera(), and QCameraWidget().

340  {
341  double dmin = fData[0];
342  double dmax = fData[0];
343  for (int ii=0;ii<ACTUAL_NUM_PIXELS;ii++)
344  {
345  if (finite(fData[ii]))
346  {
347  dmin = dmax = fData[ii];
348  break;
349  }
350  }
351  if (fMin < fScaleLimit || fMax < fScaleLimit)
352  {
353  for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
354  {
355  if (!finite(fData[i])) continue;
356  if (!fEnable[i]) continue;
357  if (fData[i] > dmax) dmax = fData[i];
358  if (fData[i] < dmin) dmin = fData[i];
359  }
360  }
361  if (fMin > fScaleLimit) dmin = fMin;
362  if (fMax > fScaleLimit) dmax = fMax;
363 // cout << "min: " << dmin << " max: " << dmax << " fMin: " << fMin << " fMax: " << fMax << endl;
364  float color;
365  for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
366  {
367  if (!fEnable[i])
368  {
369 // cout << "not enabled !" << i << endl;
370  pixelsColor[i][0] = 0.1f;
371  pixelsColor[i][1] = 0.1f;
372  pixelsColor[i][2] = 0.15f;
373  continue;
374  }
375  if (!finite(fData[i]))
376  {
377 // cout << "not enabled !" << i << endl;
378  pixelsColor[i][0] = 0.9f;
379  pixelsColor[i][1] = 0.0f;
380  pixelsColor[i][2] = 0.9f;
381  continue;
382  }
383  if (fData[i] < dmin)
384  {
388  continue;
389  }
390  if (fData[i] > dmax)
391  {
395  continue;
396  }
397  color = float((fData[i]-dmin)/(dmax-dmin));
398  if (logScale)
399  {
400  color *= 9;
401  color += 1;
402  color = log10(color);
403  }
404 
405  int index = 0;
406  while (ss[index] < color && index < 4)
407  index++;
408  index--;
409  if (index < 0) index = 0;
410  float weight0 = (color-ss[index]) / (ss[index+1]-ss[index]);
411  if (weight0 > 1.0f) weight0 = 1.0f;
412  if (weight0 < 0.0f) weight0 = 0.0f;
413  float weight1 = 1.0f-weight0;
414  pixelsColor[i][0] = weight1*rr[index] + weight0*rr[index+1];
415  pixelsColor[i][1] = weight1*gg[index] + weight0*gg[index+1];
416  pixelsColor[i][2] = weight1*bb[index] + weight0*bb[index+1];
417  }
419  UpdateText();
420  pixelColorUpToDate = true;
421  }
int i
Definition: db_dim_client.c:21
void CalculatePatchColor()
std::vector< double > fData
GLfloat tooLowValueCoulour[3]
Definition: BasicGlCamera.h:71
GLfloat pixelsColor[NPIX][3]
virtual void UpdateText()
#define ACTUAL_NUM_PIXELS
Definition: BasicGlCamera.h:9
GLfloat tooHighValueCoulour[3]
Definition: BasicGlCamera.h:70
function color(col)
Definition: color.js:31
bool pixelColorUpToDate
Definition: BasicGlCamera.h:63
std::vector< bool > fEnable
Definition: QCameraWidget.h:19

+ Here is the call graph for this function:

+ Here is the caller graph for this function: