Hi there, is there any way to get the raw YCbCr data out of a gil Image that has been read with jpeg_read_image()? *_memory is private in image.hpp and I'm not sure what it contains anyway. Any ideas? Thanks... Stephan
Am Mittwoch, 18. Februar 2009 16:41:46 schrieb Stephan Menzel:
Hi there,
is there any way to get the raw YCbCr data out of a gil Image that has been read with jpeg_read_image()?
perhaps I should be a little more verbose. I intented to use gil to read images (in that case jpeg, or from raw RGB in Mem) to iterate over the pixels and convert them into yuv planes. I wanted to use a conversion formula for this. Those yuv planes shall be plain mem blocks where I need to store the data to feed them into a C function that expects such. So I need a way to either iterate over the pixels and get the red green and blue values to use the conversion algo upon them (or I was actually hoping GIL can do this job) and offer me a view where I can access those panes and simply copy them. Studying the docs I see this is not possible but maybe someone can give me some advice on how to access those RGB pixel iterators. I think the way to start is this: boost::gil::any_image< rgb16_image_t> img; boost::gil::jpeg_read_image("image.jpg", img); boost::gil::any_image< rgb16_image_t>::view_t view(img); but what next? Thanks! Stephan
Hi Stephan, I'm not sure what you wanna do. Are your jpegs using the
YCbCr color space, meaning the images needs to read using the
JCS_YCbCr flag? If though, this color space hasn't been added yet. But
it should be fairly simple to add a YCC ( meaning YCbCr ) colorspace.
I can help here.
To access only one channel use kth_channel_view ( for compile time
creation ) or nth_channel_view ( for runtime creation ).
As you can see I'm not sure what you mean. Please send me more
information so I can help you out better.
Regards,
Christian
On Wed, Feb 18, 2009 at 2:43 PM, Stephan Menzel
Am Mittwoch, 18. Februar 2009 16:41:46 schrieb Stephan Menzel:
Hi there,
is there any way to get the raw YCbCr data out of a gil Image that has been read with jpeg_read_image()?
perhaps I should be a little more verbose. I intented to use gil to read images (in that case jpeg, or from raw RGB in Mem) to iterate over the pixels and convert them into yuv planes. I wanted to use a conversion formula for this. Those yuv planes shall be plain mem blocks where I need to store the data to feed them into a C function that expects such. So I need a way to either iterate over the pixels and get the red green and blue values to use the conversion algo upon them (or I was actually hoping GIL can do this job) and offer me a view where I can access those panes and simply copy them. Studying the docs I see this is not possible but maybe someone can give me some advice on how to access those RGB pixel iterators. I think the way to start is this:
boost::gil::any_image< rgb16_image_t> img; boost::gil::jpeg_read_image("image.jpg", img); boost::gil::any_image< rgb16_image_t>::view_t view(img);
but what next?
Thanks!
Stephan
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Am Samstag, 21. Februar 2009 23:56:24 schrieb Christian Henning:
Hi Stephan, I'm not sure what you wanna do. Are your jpegs using the YCbCr color space, meaning the images needs to read using the JCS_YCbCr flag? If though, this color space hasn't been added yet. But it should be fairly simple to add a YCC ( meaning YCbCr ) colorspace. I can help here.
To access only one channel use kth_channel_view ( for compile time creation ) or nth_channel_view ( for runtime creation ).
As you can see I'm not sure what you mean. Please send me more information so I can help you out better.
Hi Christian, essentially I got the situation where I'll need to look at given images that come in via files (such as in the jpeg example) or mem blocks (raw rgb) as YCbCr planes. These planes need to be fed into a C encoder lib, so I need them as raw mem blocks. What I did now is create a gil rgb8_t view and iterate over the whole image. Now I wrote my own converter routine (yet untested). Looking at all the different views gil offers I came to wonder if it would be possible to have a YV12 view similar to the RGB or CMYK views. From such a view I would then need all single channels as raw mem blocks. The nth_channel_view may be what I need then as long as I can get some void* out of it I can memcpy into the libs buffer. I know, it's kinda special situation but maybe it would be useful within gil since ther's already several other view types. Also I fear my own converter (using the pixel iterators) may not be as fast as a gil internal could be. Unfortunately performance is very important here. Best regards... Stephan
participants (2)
-
Christian Henning
-
Stephan Menzel