36 #include <opencv2/core/core.hpp> 37 #include <opencv2/highgui/highgui.hpp> 101 cv::Mat img = cv::imread( filename.c_str() );
104 std::cerr <<
"img.empty() == true" << std::endl;
113 int d = img.elemSize();
125 for( c = 0; c <
width_; ++c )
128 const cv::Vec3b& pixel = img.at<cv::Vec3b>(r, c);
130 uint8_t R = pixel[2];
131 uint8_t G = pixel[1];
132 uint8_t B = pixel[0];
153 for( c = 0; c <
width_; ++c )
155 img.at<
unsigned char> (r, 3*c+2) =
data_[n++];
156 img.at<
unsigned char> (r, 3*c+1) =
data_[n++];
157 img.at<
unsigned char> (r, 3*c+0) =
data_[n++];
160 cv::imwrite( filename.c_str(), img );
bool photo_image_write(const std::string &filename)
void photo_image_set_size(int image_width, int image_height, size_t image_bytes_per_pixel)
bool photo_image_read(const std::string &filename)
char * getDataAddress(void)
size_t getBytesPerPixel(void)
size_t getImageSize(void)