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