// https://qiita.com/litll_li/items/378e56b4b6877ea6676f中のhoge.cpp #include #include int main() { cv::Mat img, img_rgb; img = cv::imread("sample.jpg"); // error handling if(img.data == NULL) { std::cerr << "Error: not found such file." << std::endl; exit(1); } // convert BGR to RGB cv::cvtColor(img, img_rgb, cv::COLOR_BGR2RGB); // print pixel data std::cout << img_rgb << std::endl; }