2017-03-22 4 views

답변

0

senario 1을 부여 프레임 현재 ​​카메라를 캡처 할 때 문제가 있습니다. 유 AVCaptureDeviceInput 클래스를 사용하여 r에 경우

: CAMERA_FRONT

senario 2 :

유는 전면 카메라를 원하는 경우

AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:allTypes mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionBack]; 

u는 UR의 요구 사항에 따라 설정할 수 있습니다.

0

정확하게 이해했다면 Vuforia에 현재 Frame 개체가 있지만 UIImage 개체로 변환하면 이미지가 검은 색입니다. 그래서 문제는 PIXEL_FORMAT로 설정되어 있지 않습니다. 여기

내가 Frame 객체에서있는 UIImage 객체를 얻을 것입니다 : 당신은 아마 내가 설정 Vuforia::RGB888입니다 해요 픽셀 포맷을 발견으로

- (UIImage *)createUIImage:(const Vuforia::Image *)image 
{ 
    int width = image->getWidth(); 
    int height = image->getHeight(); 
    int bitsPerComponent = 8; 
    int bitsPerPixel = Vuforia::getBitsPerPixel(Vuforia::RGB888); 
    int bytesPerRow = image->getBufferWidth() * bitsPerPixel/bitsPerComponent; 
    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); 
    CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNone; 
    CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; 

    CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, image->getPixels(), Vuforia::getBufferSize(width, height, Vuforia::RGB888), NULL); 

    CGImageRef imageRef = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent); 
    UIImage *result = [UIImage imageWithCGImage:imageRef]; 

    CGDataProviderRelease(provider); 
    CGColorSpaceRelease(colorSpaceRef); 
    CGImageRelease(imageRef); 

    return result; 
} 

Vuforia::Image 개체가 const Vuforia::Image *image = frame.getImage(i);

에서 그리고 당신은 잊지 말아야 스크린 샷을 만들기 전에 같은 형식을 설정하십시오. Vuforia::setFrameFormat(Vuforia::RGB888, true);

이 방법을 사용하여 UDT (User Define Target) 이미지를 얻고 Vuf로 업로드하십시오 oria 구름. 다른 생각이 있다면 제발 말해줘요, 고마워요!