I am Charmie

メモとログ

CImg

CImg: hello world

I implemented CImg hello world that loads an image, display on a CImg window, and save it. The complete code is available on my github. [code lang="cpp"] include <iostream> include <string> include <CImg.h> int main() { std::cout << "run CImg hello world..." << std</cimg.h></string></iostream>…

CImg: display image(s)

This code loads an image lena.bmp and shows the original image and its grayscaled one in a window, which shows text "Original image | Grayscale image" on its bar. [code lang="c"] std::string strFile = "lena.bmp"; cimg_library::CImg<unsigned char> img1(st</unsigned>…

CImg: convert an RGB image to a grayscale image

This code loads a image lena.bmp and converts the image to grayscale one. [code lang="c"] std::string strFile = "lena.bmp"; cimg_library::CImg<unsigned char> img1(strFile.c_str()); cimg_library::CImg<unsigned char> img2; int color = _imgInput.spectrum(); // to check th</unsigned></unsigned>…

CImg: open an image file

CImg provides several constructors for cimg_library::CImg type objects. [code lang="c"] std::string strFile = "lena.bmp"; cimg_library::CImg&lt;unsigned char&gt; img1(strFile.c_str()); cimg_library::CImg&lt;unsigned char&gt; img2; img2 = c…

CImg: CMakeLists.txt

CImg is provides as a single header file, however it requires several libraries to use CImg in C++ code. CMakeLists.txt and Makefile in ./CImg-1.5.8_rolling140227/examples tells us which libraries should be set.