关于将叠加层图像与捕获图像iOS合并的问题 [英] Issue on merging the overlay image with capture image ios
本文介绍了关于将叠加层图像与捕获图像iOS合并的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发相机应用程序,其中我捕获了一张叠加图像.我正在使用以下代码进行组合图像的处理,但是徽标的位置不合适.
I am developing the camera app in which I put the one overlay image, As I captured the Image. I am doing the processing to combine the Image using the Following code but the position of the logo is not proper.
- (UIImage*)addOverlayToBaseImage:(UIImage*)baseImage {
UIImage *newImage = [self CombineImage:baseImage];
return newImage;
}
-(UIImage *)CombineImage :(UIImage*)myCapturedImage{
CGSize finalSize = [myCapturedImage size];
CGSize overlaySize = [overlayGraphic size];
UIGraphicsBeginImageContext(finalSize);
[myCapturedImage drawInRect:CGRectMake(0,0,finalSize.width,finalSize.height)];
CGFloat xScaleFactor = finalSize.width / 320;
CGFloat yScaleFactor = finalSize.height / 480;
[overlayGraphic drawInRect:CGRectMake(30 * xScaleFactor, 100 * yScaleFactor, overlaySize.width * xScaleFactor, overlaySize.height * yScaleFactor)];
UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return combinedImage;
}
我从此网址获得引用[ http://www.musicalgeometry.com/?p = 1681] 并使用捕获相机视图和图像中的全部内容
I take the reference from this url [http://www.musicalgeometry.com/?p=1681] and use that onr Capture camera view and onverlay in an image
如果我的代码有任何错误,请指导我.
Please guide me if any mistake on my code.
谢谢.
推荐答案
请尝试替换以下行:
[overlayGraphic drawInRect:CGRectMake(30 * xScaleFactor, 100 * yScaleFactor,
overlaySize.width * xScaleFactor, overlaySize.height * yScaleFactor)];
与此行
[overlayGraphic drawInRect:CGRectMake(0, 0, finalSize.width, finalSize.Height)];
这篇关于关于将叠加层图像与捕获图像iOS合并的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文