久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 iOS5 中從 CIImage 創建 UIImage 時遇到問題

Having trouble creating UIImage from CIImage in iOS5(在 iOS5 中從 CIImage 創建 UIImage 時遇到問題)
本文介紹了在 iOS5 中從 CIImage 創建 UIImage 時遇到問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在使用 AVFoundation 框架.在我的示例緩沖區委托中,我有以下代碼:

I'm using the AVFoundation framework. In my sample buffer delegate I have the following code:

-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection{
     CVPixelBufferRef pb = CMSampleBufferGetImageBuffer(sampleBuffer);
     CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pb];
     self.imageView.image = [UIImage imageWithCIImage:ciImage];
}

我可以使用 CIImage 來運行人臉檢測器等,但它沒有顯示在 UIImageView 中……imageView 仍然是白色的.關于這個問題的任何想法?我正在使用以下內容來設置我的會話:

I am able to use the CIImage to run the face detector etc. but it does not show up in the UIImageView ... the imageView remains white. Any ideas as to the problem? I am using the following to setup my session:

    self.session = [[AVCaptureSession alloc] init];
self.session.sessionPreset = AVCaptureSessionPreset640x480;
self.videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
self.videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil]; 
self.frameOutput = [[AVCaptureVideoDataOutput alloc] init];
self.frameOutput.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];

推薦答案

這可能會有所幫助.這段代碼我遇到了同樣的問題(圖像沒有被繪制到屏幕上):

This might help. I was having the same issue (image not being drawn to screen) with this code:

CIImage *image = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"mushroom.jpg"]];

theImageView.image = [UIImage imageWithCIImage:image];

但是,在將代碼更改為此之后,它現在可以正常工作了:

However, after changing the code to this, it now works correctly:

CIImage *image = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"mushroom.jpg"]];

CIContext *context = [CIContext contextWithOptions:nil];

theImageView.image = [UIImage imageWithCGImage:[context createCGImage:image fromRect:image.extent]];

要了解有關 CIContext 的更多信息,請查看此處:http://developer.apple.com/library/ios/#DOCUMENTATION/GraphicsImaging/Reference/QuartzCoreFramework/Classes/CIContext_Class/Reference/Reference.html#//apple_ref/occ/cl/CIContext

To read more about CIContext take a look here: http://developer.apple.com/library/ios/#DOCUMENTATION/GraphicsImaging/Reference/QuartzCoreFramework/Classes/CIContext_Class/Reference/Reference.html#//apple_ref/occ/cl/CIContext

這篇關于在 iOS5 中從 CIImage 創建 UIImage 時遇到問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
UITableView: Handle cell selection in a mixed cell table view static and dynamic cells(UITableView:在混合單元格表視圖靜態和動態單元格中處理單元格選擇)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
主站蜘蛛池模板: 午夜电影网站 | 宅男噜噜噜66一区二区 | 99精品国产一区二区三区 | 91就要激情 | 亚洲精品乱码久久久久久蜜桃 | 狠狠躁天天躁夜夜躁婷婷老牛影视 | 亚洲精品久久久久久久久久久久久 | 亚洲久在线 | 国产成人精品免高潮在线观看 | 日韩精品一区二区三区中文在线 | 91精品国产91久久久久久吃药 | 福利在线观看 | 亚洲国产精品99久久久久久久久 | 爽爽免费视频 | 欧美一区二区三区 | 欧美一区二区三区视频在线观看 | 中文在线一区二区 | 日韩国产高清在线观看 | 欧美一区二区 | 亚洲欧美国产精品久久 | 国产日韩免费视频 | 99re超碰| 国产精品美女久久久久aⅴ国产馆 | 日本视频在线 | 国产精品爱久久久久久久 | 三级黄色片在线播放 | 性色网站 | 91av视频| 欧美一区二区另类 | 日本精品一区二区三区视频 | 九九久久精品 | 成人国产精品入口免费视频 | 狠狠的日 | 精品一区av | 精国产品一区二区三区 | 美女在线观看av | 国产精品一区二区三区四区 | 日韩久久久久久 | 久久久精彩视频 | 精品网站999 | 日本一区二区高清不卡 |