小编bbr*_*wnd的帖子

从CVPixelBuffer参考中获取所需数据

我有一个程序可以实时查看摄像机输入并获取中间像素的颜色值.我使用captureOutput:方法从AVCaptureSession输出中获取CMSampleBuffer(恰好读作CVPixelBuffer),然后使用以下代码获取像素的rgb值:

// Get a CMSampleBuffer's Core Video image buffer for the media data
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); 
// Lock the base address of the pixel buffer
CVPixelBufferLockBaseAddress(imageBuffer, 0); 

// Get the number of bytes per row for the pixel buffer
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer); 
// Get the pixel buffer width and height
size_t width = CVPixelBufferGetWidth(imageBuffer); 
size_t height = CVPixelBufferGetHeight(imageBuffer); 
unsigned char* pixel = (unsigned char *)CVPixelBufferGetBaseAddress(imageBuffer);

NSLog(@"Middle pixel: %hhu", pixel[((width*height)*4)/2]);
int red = pixel[(((width*height)*4)/2)+2];
int green = pixel[(((width*height)*4)/2)+1];
int …
Run Code Online (Sandbox Code Playgroud)

iphone ios avcapturesession cmsamplebufferref cmsamplebuffer

10
推荐指数
1
解决办法
6706
查看次数

将ZXingObjC框架添加到项目中

既然ZXingObjC可以用作框架,我无法弄清楚如何将它添加到我的项目中.我按照git页面上的说明https://github.com/TheLevelUp/ZXingObjC,但是当我添加#import <ZXingObjC/ZXingObjC.h>xcode时找不到该文件.但是,它们提供的示例项目编译正常.

xcode frameworks add zxing

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

将按钮添加到mat-tab-group

我是Angular 2/4的新手,并且一直在享受Material Design组件(https://material.angular.io).我有一个简单的SPA,它使用一个选项卡组在动态视图之间切换.我有一个加号按钮,用于添加更多选项卡,每个选项卡都可以自行删除.

我的问题是是否可以更改mat-tab-group以包含上栏中的"加号"按钮(选项卡出现的位置).现在它位于mat-tab-group div旁边的div中,因此在我的网页的整个右侧占据了20px,这看起来并不是很好.

angular-material2 angular

4
推荐指数
2
解决办法
7134
查看次数