Ask Your Question
0

Problem with Blender

asked 2014-02-14 10:28:33 -0600

podlipensky gravatar image

updated 2014-02-14 11:10:26 -0600

berak gravatar image

Hi, I'm trying to use Blender (from stitching_details.cpp) example:

Blender* blender = Blender::createDefault(Blender::FEATHER, false);

FeatherBlender* fb = dynamic_cast<featherblender*>(static_cast<blender*>(blender));

fb->setSharpness(1.f/20);

But on a second line I've got the following error during runtime:

EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

What I'm doing wrong? I use XCode 5.0.2 and OpenCV 2.4

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-02-14 11:09:33 -0600

berak gravatar image

imho, the main problem is , that you're omitting the smartpointers there, so your 'raw' pointer is already deadbeef on line 1.

so, in the end it should be :

Ptr<Blender> blender = Blender::createDefault(Blender::FEATHER, false);

// 3.0 has dynamiccast:
// Ptr<FeatherBlender> fb = blender.dynamicCast<FeatherBlender>();

// 2.4 does it simply like this:
Ptr<FeatherBlender> fb(blender);

fb->setSharpness(1.f/20);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-02-14 10:28:33 -0600

Seen: 358 times

Last updated: Feb 14 '14