How to speed up seamlessClone? (incredibly slow)
Hi,
I am using seamlessClone to integrate a logo into a video and it is incredibly slow. Actually creating a video with 1000 frames with a resolution of 1280 x 800 takes 30 seconds. While using seamlessClone it takes round about 15 seconds to write one single frame!
I am not sure whether I use this function in a wrong way or whether seamlessClone is really that heavy.
This is basically what I do:
int main() {
cv::Mat logo= imread("logo.png", CV_LOAD_IMAGE_COLOR);
Size size(100,120);
Mat LogoResized;
resize(logo,LogoResized,size);
Point center(300,300);
Mat mask_forCloning = 255 * Mat::ones(LogoResized.rows, LogoResized.cols, LogoResized.depth());
Mat normal_clone;
Mat image;
for (int i=0; i<1000; i++)
{
image = imread(pictureName, CV_LOAD_IMAGE_COLOR); //Of course the name is changing with every frame ;-)
seamlessClone(LogoResized, image, mask_forCloning, center, normal_clone, NORMAL_CLONE);
writeCurrentFrameToVideo(normal_clone);
}
}
Is there a possibility to speed this up?
Thank you very much :-)
let me try some other way if you share your logo. ( or any png having same characteristic)
Hi, thank you very much. Due to rights I cannot provide you the original logo, but the following has the same characteristics and I just tested the cloning with it. It is comparable slow like with the logo I use. Image
Thanks a lot :-)