Hi Nate,
Thanks for the help and quick response. It works great with your changes. Do you have any feedback about the way I'm using the library in that example code? I need to iterate through each pixel's channels, do you think there are more efficient ways for accomplishing that?
Thanks again,
Mark
-----Original Message-----
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Nathan Crookston
Sent: Monday, November 07, 2011 1:20 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Gil] Unknown compilation error (VS10)
Hi Mark,
On Mon, Nov 7, 2011 at 11:12 AM, Sapp, Mark wrote:
Hi all,
I have encountered a compilation error in Visual Studio 2010 that I can't find any information online about. The error is:
error C2338: (is_same::value) template <typename Out> struct op_absoluteDifference {
template <typename T> Out operator()(const T& in1, const T&
in2) const {
return Out(abs(in2-in1));
}
};
Constructing Out is your problem -- you're initializing a multi-channel pixel type (rgb8_pixel_t) with a single value.
Either convert to a grayscale image before using calling absoluteDifference, or if you actually want the absolute difference across all channels, call static transform:
#include
#include
using namespace boost::gil;
struct op_absoluteDifferenceChannel {
template <typename T>
T operator()(const T& in1, const T& in2) const {
return T(abs(in2-in1));
}
};
struct op_absoluteDifferencePixel {
template <typename T> T operator()(const T& in1, const T& in2) const {
T retVal;
static_transform(in1, in2, retVal, op_absoluteDifferenceChannel());
return retVal;
}
};
template void absoluteDifference(const SrcView1& src1, const SrcView2& src2, const DstView& dst) {
typedef typename channel_type<DstView>::type dst_channel_t;
transform_pixels(src1, src2, dst, op_absoluteDifferencePixel()); }
int main()
{
rgb8_image_t img1(100,100);
fill_pixels(view(img1), rgb8_pixel_t(0,0,0));
rgb8_image_t img2(100,100);
fill_pixels(view(img2), rgb8_pixel_t(10,20,30));
rgb8_image_t img3(100,100);
fill_pixels(view(img3), rgb8_pixel_t(0,0,0));
absoluteDifference(const_view(img1), const_view(img2),
view(img3)); //causes compilation error C2338: (is_same::value)
gray16_image_t img4(100,100);
fill_pixels(view(img4), gray16_pixel_t(0));
gray16_image_t img5(100,100);
fill_pixels(view(img5), gray16_pixel_t(10));
gray16_image_t img6(100,100);
fill_pixels(view(img6), gray16_pixel_t(0));
absoluteDifference(const_view(img4), const_view(img5), view(img6));
return 0;
}
HTH,
Nate
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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).