Ask Your Question
2

seamlessClone runtime proportional to image size?

asked 2015-06-27 06:30:47 -0600

doriad gravatar image

updated 2018-09-14 17:36:28 -0600

I have been playing with the new seamlessClone function in OpenCV3. Of course the runtime is proportional to the size of the hole that is selected. However, I've found that with a fixed hole size, when the size of the image increases, the runtime increases substantially. For example, if I fill a 200x200 hole in a 500x500 image, it takes < 1 second. Then if I fill a 200x200 hole in a 3000x3000 image, it takes 20 seconds. (The 500x500 was a cropped version of the 3000x3000 so that the hole and source could be identical for testing to make sure it wasn't a function of the data in the hole, etc.). Can anyone confirm this behavior?

Thanks,

David

edit retag flag offensive close merge delete

Comments

The seamlessClone solve the poisson's equation of the entire area of the destination's image.

Ken_du gravatar imageKen_du ( 2017-11-23 02:25:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-06-27 08:50:26 -0600

LBerger gravatar image

updated 2015-06-27 16:37:00 -0600

After a quick reading of reference I think that is not a normal behavior for normal clonning. In paragraph Discrete poison solver equation equation (7) need all pixels of boundary destination image

I think if you want reduce time may be you can extract from a small rectangle from destination greater than your paste image and use this image as destination.

But may be there is something strange in code at line 347 (opencv\modules\photo\src\seamless_cloning_impl.cpp) computeDerivatives(destination,patch,binaryMask); there is a mask but in computeDerivatives mask is not used when gradient is estimated at line 267 (opencv\modules\photo\src\seamless_cloning_impl.cpp) . I think mask defined boundary in the paper. So why computeGradientX and Y for all images?

PS @moderator In example cloning_demo.cpp I cannot found images used in this example in opencv. I have found image in this link. I can make a Pull request but that's not my example and not my images

edit flag offensive delete link more

Comments

adding a comment saying where to find the images indeed sounds like a good idea ;)

berak gravatar imageberak ( 2015-06-27 09:13:58 -0600 )edit

Yea, I was assuming what was happening was that the derivatives were being computed for the whole image even though they were only needed in the masked region. Should I report this as a bug somewhere?

doriad gravatar imagedoriad ( 2015-06-27 16:19:59 -0600 )edit
2

May be but it's not logical for Normal cloning method and that's only my opinion. I don't know for other method.

I think you can report this a bug on opencv dev zone

LBerger gravatar imageLBerger ( 2015-06-27 16:35:38 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-27 06:30:47 -0600

Seen: 899 times

Last updated: Jun 27 '15