相关疑难解决方法(0)

如何使用NSString绘制功能从文本创建UIImage

我想NSString在a中绘制变量的内容UIImage,但我完全不知道如何做到这一点.我需要编写一个接收NSStringas参数的方法,并返回一个UIImage带有文本的方法.

iphone nsstring uiimage

36
推荐指数
2
解决办法
2万
查看次数

在iOS中用白色像素替换部分像素缓冲区

我正在使用iPhone相机捕捉实时视频并将像素缓冲区馈送到进行某些对象识别的网络.以下是相关代码:(我不会发布用于设置AVCaptureSession 等的代码,因为这是非常标准的.)

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
    CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);

    OSType sourcePixelFormat = CVPixelBufferGetPixelFormatType( pixelBuffer );
    int doReverseChannels;
    if ( kCVPixelFormatType_32ARGB == sourcePixelFormat ) {
        doReverseChannels = 1;
    } else if ( kCVPixelFormatType_32BGRA == sourcePixelFormat ) {
        doReverseChannels = 0;
    } else {
        assert(false);
    }

    const int sourceRowBytes = (int)CVPixelBufferGetBytesPerRow( pixelBuffer );
    const int width = (int)CVPixelBufferGetWidth( pixelBuffer );
    const int fullHeight = (int)CVPixelBufferGetHeight( pixelBuffer );
    CVPixelBufferLockBaseAddress( pixelBuffer, 0 );
    unsigned char* sourceBaseAddr = CVPixelBufferGetBaseAddress( pixelBuffer …
Run Code Online (Sandbox Code Playgroud)

objective-c avfoundation ios cvpixelbuffer

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