小编man*_*shg的帖子

ios9 - 裁剪CVImageBuffer的问题

我面临的几个问题与使用iOS9 SDK进行裁剪有关.

我有以下代码来调整图像大小(通过在中间裁剪从4:3转换为16:9).这曾经很好地工作到iOS8 SDK.在iOS 9中,底部区域为空白.

 (CMSampleBufferRef)resizeImage:(CMSampleBufferRef) sampleBuffer {
     {
         CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
         CVPixelBufferLockBaseAddress(imageBuffer,0);

         int target_width = CVPixelBufferGetWidth(imageBuffer);
         int target_height = CVPixelBufferGetHeight(imageBuffer);
         int height = CVPixelBufferGetHeight(imageBuffer);
         int width = CVPixelBufferGetWidth(imageBuffer);

         int x=0, y=0;

         // Convert 16:9 to 4:3
         if (((target_width*3)/target_height) == 4)
         {
             target_height = ((target_width*9)/16);
             target_height = ((target_height + 15) / 16) * 16;
             y = (height - target_height)/2;
         }
         else
         if ((target_width == 352) && (target_height == 288))
         {
             target_height = ((target_width*9)/16);
             target_height = ((target_height + 15) / …
Run Code Online (Sandbox Code Playgroud)

image crop ios ciimage ios9

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

如何检查特定的宏是否存在NSString中存储的标识符

我有名字的宏

CONSTANT_1
CONSTANT_2
CONSTANT_3
CONSTANT_4 etc..
Run Code Online (Sandbox Code Playgroud)

我有一个NSString变量从另一个类发送只包含宏名称,如何访问与此NSString匹配的宏变量的内容.

我的NSString变量定义为:

NSString *str=@"CONSTANT_3"
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios

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

标签 统计

ios ×2

ciimage ×1

crop ×1

image ×1

ios9 ×1

objective-c ×1

xcode ×1