VideoCore-Inactive icon indicating copy to clipboard operation
VideoCore-Inactive copied to clipboard

addPixelBufferSource streaming distorted image. [RESOLVED]

Open omarojo opened this issue 10 years ago • 6 comments

I noticed you added a new addPixelBufferSource method to add a UIImage on top of the video stream. But the image is all distorted once is live.

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    _session = [[VCSimpleSession alloc] initWithVideoSize:CGSizeMake(1280, 720) frameRate:30 bitrate:1000000 useInterfaceOrientation:NO];

    [_session addPixelBufferSource:[UIImage imageNamed:@"flagpoll.png"] withRect:CGRectMake(100, 100, 486, 518)];


    [self.previewView addSubview:_session.previewView];
    _session.previewView.frame = self.previewView.bounds;
    _session.delegate = self;
}
screen shot 2015-10-20 at 6 51 47 pm

omarojo avatar Oct 21 '15 01:10 omarojo

Apparently my image didn't had standard dimensions so I used a 512x512 image and it worked. Maybe only multiples of 2 ? I don't know.

omarojo avatar Oct 27 '15 09:10 omarojo

It should work with oddly-sized images...could be a bug in the code converting the UIImage to a CVPixelBufferRef - maybe strides aren't being taken into account or something

jgh- avatar Oct 27 '15 17:10 jgh-

did you ever find out the exact reason?

I can't find a pattern here... 512x512 works, 400x242 works, 526x526 doesn't, 600x600 doesn't. I can't find a pattern here...

haemi avatar Apr 01 '16 15:04 haemi

@omarojo @jgh- I'm running into same problem as you are and only 512x512 works. is it possible to make it work for smaller image? I've created an issue if you have any suggestions:

https://github.com/jgh-/VideoCore/issues/300

ashokrkm avatar Apr 11 '16 21:04 ashokrkm

seeing this same distortion, and it's over 1yr later -- please get someone on this issue

vanschroeder avatar Jun 21 '17 22:06 vanschroeder

Just use regular dimensions. Dont use weird dimensions like 526x431 or such. Im doing 720p and works fine. Also square works

On Jun 21, 2017, 3:58 PM -0700, Van Carney [email protected], wrote:

seeing this same distortion, and it's over 1yr later -- please get someone on this issue — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

omarojo avatar Jun 23 '17 01:06 omarojo