appkit  1.5.1
RoadNarrows Robotics Application Kit
WinGtkUtil.cxx File Reference

Windowing utilities. More...

#include "rnr/rnrconfig.h"
#include "rnr/log.h"
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "rnr/rnrWin.h"

Go to the source code of this file.

Functions

void ApplyColorGradient (IplImage *pImg, int red, int green, int blue)
 Apply color gradient to image. More...
 

Detailed Description

Windowing utilities.

LastChangedDate
2013-05-03 07:45:13 -0600 (Fri, 03 May 2013)
Rev
2904
Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)
Daniel Packard (danie.nosp@m.l@ro.nosp@m.adnar.nosp@m.rows.nosp@m..com)
Copyright
© 2011-2017. RoadNarrows LLC.
http://www.roadnarrows.com
All Rights Reserved

Definition in file WinGtkUtil.cxx.

Function Documentation

void ApplyColorGradient ( IplImage *  pImg,
int  red,
int  green,
int  blue 
)

Apply color gradient to image.

The gradient ranges from black to the given color, given the intensity of each pixel in the unaltered image.

Parameters
[in,out]pImgPointer to image to change.
red8-bit red component of RGB.
green8-bit green component of RGB.
blue8-bit blue component of RGB.

Definition at line 78 of file WinGtkUtil.cxx.

79 {
80  CvScalar s;
81  CvScalar t;
82  double intensity;
83 
84  for(int i=0; i<pImg->width; ++i)
85  {
86  for(int j=0; j<pImg->height; ++j)
87  {
88  s =cvGet2D(pImg, i, j);
89  intensity = ((((byte_t)s.val[0]) & 0xff) << 16) |
90  ((((byte_t)s.val[1]) & 0xff) << 8) |
91  (((byte_t)s.val[2]) & 0xff);
92  intensity /= (double)(0x00ffffff);
93  t = cvScalar(blue*intensity, green*intensity, red*intensity);
94  cvSet2D(pImg, i, j, t);
95  }
96  }
97 }