小编Gob*_*Das的帖子

在ios中录制视频时添加叠加层的方法

在录制视频时是否有任何方法可以添加叠加,这样当我从相机胶卷播放视频时,我可以看到叠加.

objective-c video-recording ios camera-roll

6
推荐指数
1
解决办法
941
查看次数

比较IOS中两个图像的RGB

在我的应用程序中,我需要比较两个图像的RGB是否相同.我正在使用此代码...

-(CGFloat)compareImage:(UIImage *)imgPre capturedImage:(UIImage *)imgCaptured
{    

int colorDiff;
CFDataRef pixelData = CGDataProviderCopyData(CGImageGetDataProvider(imgPre.CGImage));
int myWidth = (int )CGImageGetWidth(imgPre.CGImage)/2;
int myHeight =(int )CGImageGetHeight(imgPre.CGImage)/2;
const UInt8 *pixels = CFDataGetBytePtr(pixelData);

int bytesPerPixel_ = 4;
int pixelStartIndex = (myWidth + myHeight) * bytesPerPixel_;
UInt8 alphaVal = pixels[pixelStartIndex];
UInt8 redVal = pixels[pixelStartIndex + 1];
UInt8 greenVal = pixels[pixelStartIndex + 2];
UInt8 blueVal = pixels[pixelStartIndex + 3];
UIColor *color = [UIColor colorWithRed:(redVal/255.0f) green:(greenVal/255.0f) blue:(blueVal/255.0f) alpha:(alphaVal/255.0f)];
NSLog(@"color of image=%@",color);
NSLog(@"color of R=%hhu/G=%hhu/B=%hhu",redVal,greenVal,blueVal);


CFDataRef pixelDataCaptured = CGDataProviderCopyData(CGImageGetDataProvider(imgCaptured.CGImage));
int myWidthCaptured …
Run Code Online (Sandbox Code Playgroud)

rgb objective-c cgimage ios

5
推荐指数
1
解决办法
405
查看次数

标签 统计

ios ×2

objective-c ×2

camera-roll ×1

cgimage ×1

rgb ×1

video-recording ×1