Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8319173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:14:20+00:00 2026-06-08T22:14:20+00:00

A time ago I already asked this question and I also got a good

  • 0

A time ago I already asked this question and I also got a good answer:

I’ve been searching this forum up and down but I couldn’t find what I
really need. I want to get raw image data from the camera. Up till now
I tried to get the data out of the imageDataSampleBuffer from that
method
captureStillImageAsynchronouslyFromConnection:completionHandler: and
to write it to an NSData object, but that didn’t work. Maybe I’m on
the wrong track or maybe I’m just doing it wrong. What I don’t want is
for the image to be compressed in any way.

The easy way is to use jpegStillImageNSDataRepresentation: from
AVCaptureStillImageOutput, but like I said I don’t want it to be
compressed.

Thanks!

Raw image data from camera

I thought I could work with this, but I finally noticed that I need to get raw image data more directly in a similar way as it is done in “645 PRO”.

645 PRO: RAW Redux

The pictures on that site show that they get the raw data before any jpeg compression is done. That is what I want to do. My guess is that I need to transform imageDataSampleBuffer but I don’t see a way to do it completely without compression.
“645 PRO” also saves its pictures in TIFF so I think it uses at least one additional library.

I don’t want to make a photo app but I need the best quality I get to check for certain features in a picture.

Thanks!

Edit 1:
So after trying and searching in different directions for a while now I decided to give a status update.

The final goal of this project is to check for certain features in a picture which will happen with the help of opencv. But until the app is able to do it on the phone I’m trying to get mostly uncompressed pictures out of the phone to analyse them on the computer.

Therefore I want to save the “NSData instance containing the uncompressed BGRA bytes returned from the camera” I’m able to get with Brad Larson’s code as bmp or TIFF file.
As I said in a comment I tried using opencv for this (it will be needed anyway). But the best I could do was turning it into a UIImage with a function from Computer Vision Talks.

void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer);
cv::Mat frame(height, width, CV_8UC4, (void*)baseAddress);
UIImage *testImag = [UIImage imageWithMat:frame andImageOrientation:UIImageOrientationUp];
//imageWithMat... being the function from Computer Vision Talks which I can post if someone wants to see it

ImageMagick – Approach

Another thing I tried was using ImageMagick as suggested in another post.
But I couldn’t find a way to do it without using something like UIImagePNGRepresentationor UIImageJPEGRepresentation.

For now I’m trying to do something with libtiff using this tutorial.

Maybe someone has an idea or knows a much easier way to convert my buffer object into an uncompressed picture.
Thanks in advance again!

Edit 2:

I found something! And I must say I was very blind.

void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer);
cv::Mat frame(height, width, CV_8UC4, (void*)baseAddress);

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"ocv%d.TIFF", picNum]];
const char* cPath = [filePath cStringUsingEncoding:NSMacOSRomanStringEncoding];

const cv::string newPaths = (const cv::string)cPath;

cv::imwrite(newPaths, frame);

I just have to use the imwrite function from opencv. This way I get TIFF-files around 30 MB directly after the beyer-Polarisation!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:14:22+00:00Added an answer on June 8, 2026 at 10:14 pm

    I could solve it with OpenCV. Thanks to everyone who helped me.

    void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer);
    cv::Mat frame(height, width, CV_8UC4, (void*)baseAddress);
    
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"ocv%d.BMP", picNum]];
    const char* cPath = [filePath cStringUsingEncoding:NSMacOSRomanStringEncoding];
    
    const cv::string newPaths = (const cv::string)cPath;
    
    cv::imwrite(newPaths, frame);
    

    I just have to use the imwrite function from opencv. This way I get BMP-files around 24 MB directly after the bayer-filter!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've already seen this question but it's been asked over a year ago. Perhaps
I've already asked question similar to this some time ago, I thought I solved
From searching SO, this question was already asked, almost a year ago now. So
some time ago someone already asked this question and a few answers were given
I've already posted this in the Fluent NH group a long time ago, but
I already asked this exact question a year ago. My application uses Python's multiprocessing
Some time ago I was asked the strange question how would I implement map
A month ago I asked this question . Even with a Bounty nobody came
I have this code, for which I already posted something some time ago. Today
I asked this question a while ago. I now know it is a Bad

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.