Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可以:
将仅由文件名(不知道图像格式)给出的图像读取为 2d 矩阵 rgb 未压缩形式(例如,将 JPG 读取到 2d 数组)访问该图像的字节,复制它们,更改它们......(例如反向颜色,我需要一个指向图像字节的指针,setter/getter 不会做)
rgb8_image_t img; jpeg_read_image ("lena.jpg",img);
我用这些来加载图像。现在我如何访问该图像的像素或字节?
这是一个将所有像素的 G 分量设置为 128 的示例
rgb8_image_t img; const rgb8_view_t & mViewer = view(img); for (int y = 0; y < mViewer.height; ++y) { rgb8_view_t::x_iterator trIt = mViewer.row_begin(y); for (int x = 0; x < mViewer.width; ++x) at_c<1>(trIt[x]) = 128; }