Add new comment

Using Unprocessed raw data for OpenCV

Hi everyone,

First of all thanks for that wonderful library !

I've some issues, passing Raw Datas to an OpenCV Mat.

At first i used dcraw, but there is too much processing for me, my output images is blurred and pinked (yeah my picture has too much red in it i don't know why). So i tried to change dcraw processing params, but it was worse.

So i'm trying to used the unprocessed data and to fill a cv::Mat with it ! I read a lot of topics in this forum, and tried a lot of fixes, but i couldn't manage to do what i needed.

Image::Image(const char* file)
	LibRaw rawProcessor;
	libraw_processed_image_t *tmpImg;
	if(rawProcessor.open_file(file) != LIBRAW_SUCCESS)
		// !!! Exception to handle !!!
		//rawProcessor.imgdata.params.no_interpolation = 1;
		//rawProcessor.imgdata.params.no_auto_scale = 1;
		//rawProcessor.imgdata.params.no_auto_bright = 1;
		//int check = rawProcessor.dcraw_process();
		//tmpImg = rawProcessor.dcraw_make_mem_image(&check);
		// Init image
		Img = cv::Mat(rawProcessor.imgdata.sizes.width, rawProcessor.imgdata.sizes.height, CV_16UC3, rawProcessor.imgdata.rawdata.raw_image);
		// Init datas
		cameraModel = (std::string) rawProcessor.imgdata.idata.make + "-" + rawProcessor.imgdata.idata.model;
		shutterTime = rawProcessor.imgdata.other.shutter;
	// Free rawProcessor

And I can't do a single thing on this matrix. It seems that rawProcessor.imgdata.rawdata.raw_image is empty or Null ...

If anyone can help me, i just come back to cpp after a long break using matlab i may make some basic cpp mistakes and i'm really sorry about that.