supplierdeeply

Can't use CRW files

  • 29 Replies
  • 18504 Views
*

Offline uhoh

  • *
  • 14
Can't use CRW files
« on: 07 / March / 2017, 20:46:19 »
Advertisements
Hi all,
I forgot to enable DNG mode, so my raw files are in the CRW format, which macOS does not understand. I compiled DCRAW and it too cannot understand these CRW files. I also tried the decompress.c program on Dave Coffin's website but it as well cannot understand these CRW's. My camera is an ELPH 110.
Any suggestions?
Thanks.
Here is the file:
https://www.dropbox.com/s/93ew7b8sdc8zkmz/CRW_2435.CRW?dl=0

*

Offline reyalp

  • ******
  • 11339
Re: Can't use CRW files
« Reply #1 on: 07 / March / 2017, 22:04:12 »
The "CRW" files are not in any real format, they are just a dump of the camera sensor, so any program that supports them needs updated parameters for each new sensor size. That's why we recommend and default to DNG these days.

You could add a profile for your camera in DNG4PS-2, see
 https://chdk.setepontos.com/index.php?topic=6754.0

Don't forget what the H stands for.

*

Offline uhoh

  • *
  • 14
Re: Can't use CRW files
« Reply #2 on: 08 / March / 2017, 10:41:51 »
The "CRW" files are not in any real format, they are just a dump of the camera sensor, so any program that supports them needs updated parameters for each new sensor size. That's why we recommend and default to DNG these days.
You could add a profile for your camera in DNG4PS-2, see
 https://chdk.setepontos.com/index.php?topic=6754.0

But it also appears to be compressed somehow because there's 1.58 bytes per RGBG subpixel set.
If it weren't compressed I'd just write a C program to do a demosaic operation and write out a BMP.

BTW DNG4PS-2 doesn't build on the Mac.

Re: Can't use CRW files
« Reply #3 on: 08 / March / 2017, 14:10:46 »
But it also appears to be compressed somehow because there's 1.58 bytes per RGBG subpixel set.  If it weren't compressed I'd just write a C program to do a demosaic operation and write out a BMP.
You might find this interesting :   How pixel values are stored in CHDK raw?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 11339
Re: Can't use CRW files
« Reply #4 on: 08 / March / 2017, 16:03:33 »
If it weren't compressed I'd just write a C program to do a demosaic operation and write out a BMP.
It's packed 12 bpp little endian. The rawconvert tool in the chdk source has code to convert this into something easier to work with https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/tools/rawconvert.c

Don't forget what the H stands for.

*

Offline uhoh

  • *
  • 14
Re: Can't use CRW files
« Reply #5 on: 08 / March / 2017, 17:54:45 »
https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/tools/rawconvert.c

Hmm... In the case of my camera, the ELPH 110HS,
     http://chdk.wikia.com/wiki/ELPH110HS
I thought the resolution is 4608x3456 = 15925248 pixels.
The CRW file is 25230816 bytes.
25230816 / 15925248 = 1.5843, or roughly 16-to-10.

So if I assume it's a 16-to-10 conversion...
I shouldn't be getting this error from rawconvert... right?

./rawconvert -16to10 -w=4608 -h=3456 -pgm CRW_2435.CRW IMG_2435.PGM
WARNING: Portable Gray Map (PGM) format supports only 8 or 16 bpp.
./rawconvert: CRW_2435.CRW mismatched size (4608*3456*16)/8 -> 31850496 != 25230816

./rawconvert -16to10 -w=4608 -h=3456  CRW_2435.CRW IMG_2435
./rawconvert: CRW_2435.CRW mismatched size (4608*3456*16)/8 -> 31850496 != 25230816

But OK let's try 12 to 8:

./rawconvert -12to8 -w=4608 -h=3456  CRW_2435.CRW IMG_2435
./rawconvert: CRW_2435.CRW mismatched size (4608*3456*12)/8 -> 23887872 != 25230816

10 to 8?

./rawconvert -10to8 -w=4608 -h=3456  CRW_2435.CRW IMG_2435
./rawconvert: CRW_2435.CRW mismatched size (4608*3456*10)/8 -> 19906560 != 25230816

Oh well.
« Last Edit: 08 / March / 2017, 18:05:08 by uhoh »

*

Offline srsa_4c

  • ******
  • 3629
Re: Can't use CRW files
« Reply #6 on: 08 / March / 2017, 20:31:06 »
From the source
Code: [Select]
    #define CAM_RAW_ROWPIX                      4784 // Found @0xff15d2f8 ixus125 100d
    #define CAM_RAW_ROWS                        3516 // Found @0xff15d304 ixus125 100d
Also, bit depth is definitely 12 bits per pixel.

Re: Can't use CRW files
« Reply #7 on: 08 / March / 2017, 20:37:09 »
From the source
Code: [Select]
    #define CAM_RAW_ROWPIX                      4784 // Found @0xff15d2f8 ixus125 100d
    #define CAM_RAW_ROWS                        3516 // Found @0xff15d304 ixus125 100d
Also, bit depth is definitely 12 bits per pixel.
The OP's row/column data is for the JPEG for that camera. 
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline uhoh

  • *
  • 14
Re: Can't use CRW files
« Reply #8 on: 08 / March / 2017, 23:58:35 »
 
From the source
Code: [Select]
    #define CAM_RAW_ROWPIX                      4784 // Found @0xff15d2f8 ixus125 100d
    #define CAM_RAW_ROWS                        3516 // Found @0xff15d304 ixus125 100d
Also, bit depth is definitely 12 bits per pixel.


./rawconvert -12to8 -w=4784 -h=3516 -pgm  CRW_2435.CRW IMG_2435.pgm
input:  CRW_2435.CRW 4784x3516 12 bpp 25230816 bytes
output: IMG_2435.pgm 8 bpp 16820544 bytes
 discard lower 4 bits
done

I converted all of my CRWs to pgm and they're all random-looking messes. Sometimes my camera puts out jibberish DNGs as well when the shooting mode isn't what it wants. But they usually look a bit different than these.
« Last Edit: 09 / March / 2017, 00:07:12 by uhoh »

*

Offline reyalp

  • ******
  • 11339
Re: Can't use CRW files
« Reply #9 on: 09 / March / 2017, 02:14:38 »
I converted all of my CRWs to pgm and they're all random-looking messes. Sometimes my camera puts out jibberish DNGs as well when the shooting mode isn't what it wants. But they usually look a bit different than these.
If you can upload an example of one of the original CRW files somewhere (dropbox, google drive etc), we may be able to get a better idea of what's happening.

Note that rawconvert does not demosiac, it just takes the packed 12 bit data and converts it 8 or 16 bit formats that can be loaded into other imaging programs. If you load the resulting pgm in gimp or similar, you will generally a recognizable grayscale image with a checkerboard pattern from the CFA.
Don't forget what the H stands for.

 

Related Topics