2

I want to use a GPUImageTransformFilter to crop a live video stream from GPUImageVideoCamera.

 GPUImageTransformFilter *transformFilter = [[GPUImageTransformFilter alloc] init];

 // Zoom is 4x
 [transformFilter setAffineTransform:CGAffineTransformMakeScale(4, 4)];

 // Is this needed. Say the zoom is 4 and the video stream size is 320 x 426. It that right?
 [transformFilter forceProcessingAtSize:CGSizeMake(320*4, 426*4)];

 [videoCameraDevice addTarget:transformFilter];
 [transformFilter addTarget:liveTextureFilter]

 [transformFilter prepareForImageCapture];      
 [videoCameraDevice resumeCameraCapture];

I have two problems:

1) The orientation of the video stream is rotated by 90 degrees.

2) The output in my GPUImageView flickers between the image without the transform (as if no transform was applied) and the 90-degree-rotated, transformed image at an approximate rate of 1/10th a second on an iPhone 5s.

Any ideas of what I am doing wrong and/or how would you approach cropping live video with a texture on top of the video stream that you do not want cropped?

kev
  • 7,062
  • 10
  • 26
  • 40
  • Are you sure the videoCameraDevice isn't still targeting something further down the filter chain (your liveTextureFilter and beyond)? I've seen this kind of flickering before in cases like that, where targets weren't fully removed. If you go directly from camera->transform->GPUImageView, do you see the same artifacts? – Brad Larson Oct 02 '13 at 20:46
  • Yes, the same artifacts show without the texture in the filter stack. – kev Oct 02 '13 at 21:04
  • Is this only on 5S, or does it appear on other devices? When you run the FilterShowcase example on your device, do the 2-D and 3-D transform examples exhibit this same flickering? They don't on my iPhone 5, but my 5S hasn't arrived yet. – Brad Larson Oct 02 '13 at 21:05
  • For my issue, the problem exists on the iPhone 5 as well. The 2D and 3D transformations for filter showcase do not flicker with the iPhone 5s, instead they appear to work fine. – kev Oct 02 '13 at 21:19
  • OK, so it's something that's different between your setup code and the FilterShowcase example's. What happens if you remove `-forceProcessingAtSize:` from your code? Maybe you could identify something that's different which is triggering this in your case. – Brad Larson Oct 02 '13 at 21:22
  • That doesn't seem to change anything. – kev Oct 02 '13 at 21:28

0 Answers0