ViSP  2.8.0
tutorial-image-manipulation.cpp
1 
2 #include <visp/vpImage.h>
3 
4 int main()
5 {
6  vpImage<unsigned char> gray_image(240, 320);
7  vpImage<vpRGBa> color_image(240, 320);
8 
9  gray_image = 128;
10  vpRGBa color(255, 0, 0);
11  color_image = color;
12 
13  unsigned int igray_max = gray_image.getHeight() - 1;
14  unsigned int jgray_max = gray_image.getWidth() - 1;
15  std::cout << "Gray image, last pixel intensity: "
16  << (int)gray_image[igray_max][jgray_max] << std::endl;
17 
18  unsigned int icolor_max = color_image.getHeight() - 1;
19  unsigned int jcolor_max = color_image.getWidth() - 1;
20  std::cout << "Color image, last pixel RGB components: "
21  << (int)color_image[icolor_max][jcolor_max].R << " "
22  << (int)color_image[icolor_max][jcolor_max].G << " "
23  << (int)color_image[icolor_max][jcolor_max].B
24  << std::endl;
25 }
Class that defines a RGB 32 bits structure.
Definition: vpRGBa.h:68