Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost gil get buffer from rgb8_view_t [duplicate]

I need to use boost GIL library to load a '.bmp' image, copy it to buffer and send it through sockets.

I copied the image in rgb8_view_t and tried to get pixels out of it but found no function which can do so. Following is the code snippet I wrote:

rgb8_image_t img;
bmp_read_image("test.bmp", img);
rgb8_view_t myView(view(img));

Please suggest if there is some other way to get the buffer out of the image.

like image 674
Aman Avatar asked Dec 29 '25 11:12

Aman


1 Answers

Something like this should do it...

gil::rgb8_image_t::const_view_t view = const_view(img);

assert(view.is_1d_traversable());

int width = view.width();
int height = view.height();
const char* buffer = view.begin().x();
like image 117
combinatorial Avatar answered Dec 31 '25 04:12

combinatorial