Raw image data from camera like “645 PRO”

后端 未结 4 1431
庸人自扰
庸人自扰 2020-11-30 05:09

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 reall

4条回答
  •  春和景丽
    2020-11-30 05:53

    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!

提交回复
热议问题