[gil] metafunction for layout
Hi All,
The following code is straight out of the tutorial about making function
generic. Can anyone suggest how I might determine the layout of DstView
here so that I can build an image of the same layout? In this example
they hardcode gray_layout_t and I'm not seeing any metafunctions that
return the layout.
template
Hi Mark,
Luminosity is a single channel, and single-channel images in GIL are specified using a gray_layout_t layout. It doesn't make sense to keep the layout of the destination view; in fact you should require that the destination view is a single channel view (i.e. has a gray_layout_t layout)
Lubomir
On Nov 16, 2011, at 2:35 PM, Sapp, Mark wrote:
Hi All,
The following code is straight out of the tutorial about making function generic. Can anyone suggest how I might determine the layout of DstView here so that I can build an image of the same layout? In this example they hardcode gray_layout_t and I’m not seeing any metafunctions that return the layout.
template
Hi Lubomir,
Thanks for the quick reply. I understand what you are saying and agree, but in my case I’m not doing the exact same thing as the example. I included the example for clarification. I’m actually manipulating an image and need a working copy with float point precision created inside a generic function. My function looks like the following and I want to remove the gray_layout_t with whatever layout src1 uses.
template
Hi Lubomir,
Luminosity is a single channel, and single-channel images in GIL are specified using a gray_layout_t layout. It doesn't make sense to keep the layout of the destination view; in fact you should require that the destination view is a single >channel view (i.e. has a gray_layout_t layout)
You mentioned requiring inputs to be a specific layout and it got me thinking about what I currently do. I have generic functions that use the ColorSpacesCompatibleConcept but will compile and execute if the inputs are of different colorspaces. For example, a rgb8_view_t and a gray8_view_t can be passed in and pass the ColorSpacesCompatibleConcept check. What makes 2 colorspaces compatible? The documentation leads me to believe that they have to be identical for them to be compatible. How does the example I gave (rgb8 and gray8) not cause an issue? I can try to build an example if this is not expected behavior. If it is expected behavior, can you explain how the static_transform operation pairs the channels between those 2 images? Thanks, Mark Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s).
Hi All, I was able to accomplish what I needed using the following code. Please provide feedback if you see any potential issues/flaws or a cleaner way to define derived types. void function(const SrcView& src, const DstView& dst) const { typedef typename channel_type< DstView >::type dstChannelType; typedef typename channel_mapping_type< DstView >::type dstChannelMappingType; typedef typename color_space_type< DstView >::type dstColorSpaceType; typedef typename layout< dstColorSpaceType, dstChannelMappingType > dstLayout; typedef typename image_type< dstChannelType, dstLayout >::type dstImageType; typedef typename dstImageType::value_type dstPixelType; typedef typename image_type< bits32f, dstLayout >::type dst32f_image_t; typedef typename dst32f_image_t::value_type dst32f_pixel_t; ... With this I can create images inside this function that are bit32f versions of dst. I wish there was a metafunction that returned the layout of view, so that I could simplify this to 1 or 2 lines of code, but functionally it works. Also, dstPixelType is used with color_convert_view as demonstrated below. I’d appreciate any feedback about more appropriate ways of converting the src to the dst type. color_converted_view< dstPixelType >(src) Thanks, Mark Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s).
participants (2)
-
Lubomir Bourdev
-
Sapp, Mark