Page 10 of 10

Re: RAW output information

Posted: Wed Apr 12, 2017 2:59 pm
by 6by9
Bryan See wrote:Came by to see this thread, I'll comment around a bit. I tried the first example Python script of the Bayer capture, but I still cannot open the image file generated at the end of it, as the file is supposed to be readable in most packages (like GIMP and Photoshop). The question is: Could that be in DNG format? Or something else?

BTW, I've extracted the bayer data from the Jpeg stream or file, whether it's V1 or V2.
You've posted on viewtopic.php?f=43&t=146310&start=25#p1146735 and had responses.
Why the need to cross post the same question onto another thread?

Re: RAW output information

Posted: Fri Apr 14, 2017 5:50 am
by Bryan See
From what I've found out on that section, the bayer pattern for the IMX219 is:

GR
BG

which means GRBG, I think. But how do the RAW output of the IMX219 image look like?
6by9 wrote:
Bryan See wrote:Came by to see this thread, I'll comment around a bit. I tried the first example Python script of the Bayer capture, but I still cannot open the image file generated at the end of it, as the file is supposed to be readable in most packages (like GIMP and Photoshop). The question is: Could that be in DNG format? Or something else?

BTW, I've extracted the bayer data from the Jpeg stream or file, whether it's V1 or V2.
You've posted on viewtopic.php?f=43&t=146310&start=25#p1146735 and had responses.
Why the need to cross post the same question onto another thread?
To add the knowledge of RAW image outputs here.

Re: RAW output information

Posted: Thu May 11, 2017 3:43 pm
by bmw318
Hi,
using the RPi and the V2 camera, I want to acquire the RAW image from the image sensor directly without extracting it from the JPG file. Extracting takes a very long time. I think the sensor has to put into RAW mode by use of its serial commands, isn't it?
Is there somebody who knows how to do it?

Would love to heat from you.

Regards.

Re: RAW output information

Posted: Thu May 11, 2017 3:56 pm
by jbeale
On the Raspberry Pi, the camera sensor is always used in RAW mode, so the raw image data is always transferred to the RPi. It is the ISP system onboard the RPi SoC (in the GPU) that does the image processing and creates the JPEG still or H.264 video data. The relative slowness of processing RAW data on the CPU has to do with processor speed and bus bandwidth on the ARM side of the hardware. The GPU is much faster, having more parallel hardware that was designed for that task.

Re: RAW output information

Posted: Thu May 11, 2017 4:02 pm
by 6by9
bmw318 wrote:Hi,
using the RPi and the V2 camera, I want to acquire the RAW image from the image sensor directly without extracting it from the JPG file. Extracting takes a very long time.

Code: Select all

tail -c -10270208 output.jpg > output.raw
The time taken will be totally dependent on the speed of the storage, but generally pretty minimal.
Or are you complaining that producing the file takes too long? There is a potential tweak for raspistill that would speed up the transfer from the GPU, but I couldn't say by how much.
bmw318 wrote:I think the sensor has to put into RAW mode by use of its serial commands, isn't it?
Is there somebody who knows how to do it?
The sensor is always producing Bayer as it has no processing block to convert from Bayer to YUV (that is normally done in the SoC).

If you really want to get down to just raw Bayer, then look at viewtopic.php?f=43&t=109137, or there will soon be a V4L2 driver that can receive the data. (There's an upstream driver for OV5647, but not for IMX219 as yet). Exposure and gain control is then totally down to you.

Re: RAW output information

Posted: Tue May 16, 2017 6:03 pm
by bmw318
Hi,
Thank you for your answer.
I was refering to Picamera because I want to acquire a RAW image from within Python. This takes a very long time. Doing measurements on many successive frames is undoable.
I noticed that there are many definitions regarding RAW images. What I define as RAW is the real contents of a pixel without any processing.

Regards.

Re: RAW output information

Posted: Wed May 17, 2017 8:40 am
by 6by9
bmw318 wrote:I was refering to Picamera because I want to acquire a RAW image from within Python. This takes a very long time. Doing measurements on many successive frames is undoable.
You hadn't stated how you were trying to access raw frames, and we have to share the crystal balls around when trying to mind read ;)
Can you provide a small snippet of code that you are trying to run? TBH The number crunching on the resultant images is likely to take a significant amount of time, particularly with the raw 10 packing used. The PiCamera docs around Bayer captures include various levels of processing. What of those are you using?
bmw318 wrote:I noticed that there are many definitions regarding RAW images. What I define as RAW is the real contents of a pixel without any processing.
Just to check, you are aware of Bayer patterns then? The sensor produces a Bayer image natively, not a full resolution RGB or YUV.

Re: RAW output information

Posted: Thu Jul 06, 2017 4:51 pm
by cgoins
Do other people's demosaiced raw images look something like this? My demosaicing of jbeale's raw images are darker and greener that what I've seen others post. I'm using BGGR as the Bayer pattern and am pretty confident that is correct. I know I can adjust the image to look better but I want to know whether this is what the raw images look like for others.

Re: RAW output information

Posted: Mon Jul 10, 2017 4:48 pm
by blindbloom
This is the typical result of performing demosaic only. The sensor values are linear with respect to scene radiance (aka scene-referred), which accounts for the dark appearance. A raw processing pipeline (e.g. David Coffin's dcraw) applies additional color processing to put the image into an output-referred form for normal viewing (e.g. sRGB/JPEG). This processing includes things like overall gain (exposure), channel-specific gains (white balance), 3x3 matrix, film curves, etc.

Re: RAW output information

Posted: Mon Jul 10, 2017 5:00 pm
by 6by9
blindbloom wrote:This is the typical result of performing demosaic only. The sensor values are linear with respect to scene radiance (aka scene-referred), which accounts for the dark appearance. A raw processing pipeline (e.g. David Coffin's dcraw) applies additional color processing to put the image into an output-referred form for normal viewing (e.g. sRGB/JPEG). This processing includes things like overall gain (exposure), channel-specific gains (white balance), 3x3 matrix, film curves, etc.
The updated version of dcraw at https://github.com/6by9/RPiTest/tree/master/dcraw also directly handles the JPEG+RAW format that the Pi produces, for both Pi camera modules and all of their modes. It doesn't have a colour calibration for the V2 sensor though.

Re: RAW output information

Posted: Tue Oct 02, 2018 2:19 pm
by Egg_man
Hi! I have a question: what's the quickest way to extract the RAW information from the jpeg image into a numpy array? I did acquire a set of pictures with raspistill -r because setting the exposure time in picamera gave me some problems, and now I'd like to process them with Python and OpenCV.

Re: RAW output information

Posted: Tue Dec 04, 2018 9:54 pm
by thatneat
what's the quickest way to extract the RAW information from the jpeg image into a numpy array?
My team just released a fork of picamera that is designed just for this. Check out https://github.com/OsmoSystems/picamraw/ and let us know how it goes!