Ask Your Question

pawlusmall's profile - activity

2016-04-24 13:35:48 -0600 asked a question OpenCV iOS seamlessClone function gives memory error

I'm trying to use seamlessClone OpenCV function on iOS, but I'm always getting an EXC_BAD_ADDRESS error.

Here it is the code:

Mat output;
seamlessClone(warped_frame, backgroundFrame, warped_mask, center, output, 1);

Also tried with:

Mat output = Mat::zeros(backgroundFrame.rows, backgroundFrame.cols, backgroundFrame.type())
seamlessClone(warped_frame, backgroundFrame, warped_mask, center, output, 1);

It gives a memory error when allocating output inside seamlessClone function.

The types and sizes of the input params are:

Warped frame type: 16
Background frame type: 16
Warped mask type: 16
Warped frame size: [338 x 338]
Background frame size: [338 x 338]
Warped mask size: [338 x 338]
Center point: [154, 293]

Type 16 is CV_8UC3.

From the function documentation:

@Param src Input 8-bit 3-channel image.
@Param dst Input 8-bit 3-channel image.
@Param mask Input 8-bit 1 or 3-channel image.
@Param p Point in dst image where object is placed.
@Param blend Output image with the same size and type as dst.
@Param flags Cloning method.

Everything seems fine.

Any clue on this?