// The function running all different image processes who's bool's set to true
void imageProcess::theInterestingPart() {
	setSize(320, 240);
	if (usesRoiMaker) {
		ROIMaker();
	}
	if (usesContrast) {
		Contrast();
	}
	if (usesfixLight) {
		fixLight();
	}
	if (usesMakeBinary) {
		makeBinary();
	}
	if (usesThreshold) {
		Theshold();
	}
	if (usesFilterWhiteAreas) {
		filterWhiteAreas();
	}
  if (usesFilterWhiteLines) {
    filterWhiteLines();
  }
	if (usesSkelMaker) {
		skelMaker();
	}
	if (usesHoughLinesPLR) {
		HoughlinesPLR();
	}
	resetSize();

}
Esempio n. 2
0
//Histogram *Unser(Image *img)
float *Unser(Image *img)
{
  Histogram *h = NULL;
  float sum[4][511], dif[4][511], *val=NULL;
  float mean, contrast, correlation;
  int i;

  val = (float*) calloc(SIZE,sizeof(float));

  ComputeHistograms(img, sum, dif);

  for (i=0; i<4; i++){
    mean = Mean(sum[i]);
    val[i * 8 + 0] = mean;
    contrast = Contrast(dif[i]);
    val[i * 8 + 1] = contrast;// / 255.0;
    correlation = Correlation(sum[i], mean, contrast);
    val[i * 8 + 2] = (correlation);// + 32512.5) / 255.0;
    val[i * 8 + 3] = Energy(sum[i], dif[i]);// * 255.0 ;
    val[i * 8 + 4] = Entropy(sum[i], dif[i]);// * 255.0 / 5.4168418;
    val[i * 8 + 5] = Homogeneity(dif[i]);// * 255.0;
    val[i * 8 + 6] = MaximalProbability(sum[i]);// * 255.0;
    val[i * 8 + 7] = StandardDeviation(contrast, correlation);// *sqrt(2);
  }

  //h = CreateHistogram(SIZE);
  //LinearNormalizeHistogram(h->v, val, 255.0, SIZE);

  //return(h);
  return(val);
}
Esempio n. 3
0
int32_t screenSpin::Fadein(void)
{
  int32_t	Contrastnum;
  Contrastnum = 0;
  while (Contrastnum < 16) {
    Contrast(Contrastnum);
    Contrastnum = (Contrastnum + 1);
    waitcnt(((CLKFREQ / 8000) + CNT));
  }
  return 0;
}
Esempio n. 4
0
int32_t screenSpin::Fadeout(void)
{
  int32_t	Contrastnum;
  Contrastnum = 15;
  while (Contrastnum > (-1)) {
    Contrast(Contrastnum);
    Contrastnum = (Contrastnum - 1);
    waitcnt(((CLKFREQ / 8000) + CNT));
  }
  return 0;
}
Esempio n. 5
0
//-----------------------------------------------------------------------------
bool tIMX51Video::SetContrastInternal()
{
    if(m_pGstSource)
    {
        GParamSpec *param = g_object_class_find_property(G_OBJECT_GET_CLASS(m_pGstSource), "contrast");
        if(!param)
            return false;
        GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
        if(!pint)
            return false;

        int val = (pint->maximum - pint->minimum) * Contrast() / 100 + pint->minimum;

        //qDebug() << "Setting contrast" << val;
        g_object_set(m_pGstSource, "contrast", val, NULL);
    }
    return false;
}
Esempio n. 6
0
void LCD1602::Init()
{
	PinInit();
	Brightness(false);
	RW(false);
	RS(false);
	DB4(0);
	E(false);

	// Wait 50 ms from power on
	delay_ms(50);

	DB4(3);

	// Run three clock cycles to init
	E(true);
	LCD_DELAY_SHORT;
	E(false);
	LCD_DELAY_LONG;

	E(true);
	LCD_DELAY_SHORT;
	E(false);
	LCD_DELAY_SHORT;

	E(true);
	LCD_DELAY_SHORT;
	E(false);
	LCD_DELAY_SHORT;

	// Configure display

	DB4(2);

	E(true);
	LCD_DELAY_SHORT;
	E(false);
	LCD_DELAY_LONG;

	DB(0x28);
	LCD_DELAY_SHORT;
	DB(0x8);
	LCD_DELAY_SHORT;
	DB(0x1);
	LCD_DELAY_SHORT;
	DB(0x6);
	LCD_DELAY_SHORT;

	RS(false);
	DB(0x0c);
	LCD_DELAY_LONG;

	// Test code, TODO

	Locate(0, 0);
	Print(" ld analyzer b1 ");
	Locate(0, 1);
	Print(" analyzer-1     ");
	//Brightness(true);
	Contrast(false);

	// Enable SCT peripheral clock
	CGU_ConfigPWR(CGU_PERIPHERAL_SCT, ENABLE);
	LPC_CCU1->CLK_M4_SCT_CFG |= CCU1_CLK_M4_SCT_CFG_RUN_Msk;
	while(!(LPC_CCU1->CLK_M4_SCT_STAT & CCU1_CLK_M4_SCT_STAT_RUN_Msk));

	scu_pinmux(0x1,  5,  GPIO_PUP, FUNC1); // CTOUT_10

	LPC_SCT->CONFIG = (1 << 17);
	LPC_SCT->CTRL_L |= (12-1) << 5;
	LPC_SCT->MATCHREL[0].L = 100-1;
	LPC_SCT->MATCHREL[1].L = 1;
	LPC_SCT->EVENT[0].STATE = 0xFFFFFFFF;
	LPC_SCT->EVENT[0].CTRL = (1 << 12);
	LPC_SCT->EVENT[1].STATE = 0xFFFFFFFF;
	LPC_SCT->EVENT[1].CTRL = (1 << 12) | (1 << 0);

	LPC_SCT->OUT[10].SET = (1 << 0);
	LPC_SCT->OUT[10].CLR = (1 << 1);

	LPC_SCT->CTRL_L &= ~(1 << 2);

	InitFont();

	// Fade in
	for (int i = 0; i < 100; i++)
	{
		LPC_SCT->MATCHREL[1].L = i;
		delay_ms(10);
	}
}
Esempio n. 7
0
	virtual Image Make() const {
		return Contrast(img, 256 + d);
	}
Esempio n. 8
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%     C o n t r a s t I m a g e                                               %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Method ContrastImage enhances the intensity differences between the
%  lighter and darker elements of the image.
%
%  The format of the ContrastImage method is:
%
%      void ContrastImage(Image *image,const unsigned int sharpen)
%
%  A description of each parameter follows:
%
%    o image: The address of a structure of type Image;  returned from
%      ReadImage.
%
%    o sharpen: If True, the intensity is increased otherwise it is
%      decreased.
%
%
*/
Export void ContrastImage(Image *image,const unsigned int sharpen)
{
#define DullContrastImageText  "  Dulling image contrast...  "
#define SharpenContrastImageText  "  Sharpening image contrast...  "

  int
    sign,
    y;

  register int
    i,
    x;

  register PixelPacket
    *q;

  assert(image != (Image *) NULL);
  sign=sharpen ? 1 : -1;
  switch (image->class)
  {
    case DirectClass:
    default:
    {
      /*
        Contrast enhance DirectClass image.
      */
      for (y=0; y < (int) image->rows; y++)
      {
        q=GetPixelCache(image,0,y,image->columns,1);
        if (q == (PixelPacket *) NULL)
          break;
        for (x=0; x < (int) image->columns; x++)
        {
          Contrast(sign,&q->red,&q->green,&q->blue);
          q++;
        }
        if (!SyncPixelCache(image))
          break;
        if (QuantumTick(y,image->rows))
          {
            if (sharpen)
              ProgressMonitor(SharpenContrastImageText,y,image->rows);
            else
              ProgressMonitor(DullContrastImageText,y,image->rows);
          }
      }
      break;
    }
    case PseudoClass:
    {
      Quantum
        blue,
        green,
        red;

      /*
        Contrast enhance PseudoClass image.
      */
      for (i=0; i < (int) image->colors; i++)
      {
        red=image->colormap[i].red;
        green=image->colormap[i].green;
        blue=image->colormap[i].blue;
        Contrast(sign,&red,&green,&blue);
        image->colormap[i].red=red;
        image->colormap[i].green=green;
        image->colormap[i].blue=blue;
      }
      SyncImage(image);
      break;
    }
  }
}
Esempio n. 9
0
int32_t screenSpin::On(void)
{
  Contrast(15);
  return 0;
}
Esempio n. 10
0
int32_t screenSpin::Off(void)
{
  Contrast(0);
  return 0;
}
Esempio n. 11
0
void GridDisplay::SetTheme(int th)
{
	theme = th;
	hdrhigh = Contrast(vhdr[theme](), 230);	
}