Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
AVCaptureSession sample buffer to pixels inconsistent values
I have the following code where I am grabbing all captured frames from the iphone video camera and trying to loop through all the pixels in each image.
I wrote the code below, but for some reason I get slightly different color values when I use my RGBPixel structure method versus just grabbing the pixels colors straight from the uint8_t buffer that I get from CVPixelBufferGetBaseAddress. I have been pulling my hair out to figure out what I might be doing wrong, I don't see why the r,g,b values are not the same for each method. They should be.
What I want to do is get the average r,g,b values for the entire image, but I need it to be accurate and I can't figure out why my results are not consistent. Can anyone look at my code and see what I might be doing wrong?
I hate answering my own question... but hey that's the best way to figure out the answer right? spend 15 hours try to fix the bug, finally break down and post it and like clock work you will solve it yourself minutes after posting ;)
problem was my image was in BGRA format so I had the red and blue variables in my struct in wrong places. needs to be like below
Then it should be called BGRPixel, not RGBPixel. I have done a lot of video capturing on the iPhone, and i often run into the BRG-format. Anybody know if its the native video format, or why Apple is using it all the time?
Basically you have the following format combinations: RGB or BGR, either without an A(lpha), with an A in front or an A in the back. At least when capturing / rendering stuff.
Replies
problem was my image was in BGRA format so I had the red and blue variables in my struct in wrong places. needs to be like below
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeBasically you have the following format combinations: RGB or BGR, either without an A(lpha), with an A in front or an A in the back. At least when capturing / rendering stuff.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome