Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Canon CCD-RAW format specifiction wanted

2 views
Skip to first unread message

Adam Eberbach

unread,
Jun 28, 1999, 3:00:00 AM6/28/99
to
I'd like to know the file format for this kind of file, so that I can get
images from my camera by inserting the CF into my laptop, copying them
and archiving them untouched - but still view them. I intend writing a
CCD-RAW to PNG converter if I can get the specification.

--
Adam Eberbach

Jon Hill

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
It is my understanding that only the Canon software can read these
correctly, so it will probably not be some common file format.

-jh

Adam Eberbach <aebe...@bigpond.com> wrote in message
news:MPG.11e1ee654...@news.bigpond.com...

Duke

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
Adam Eberbach <aebe...@bigpond.com> wrote in message
news:MPG.11e1ee654...@news.bigpond.com...
> I'd like to know the file format for this kind of file, so that I can get
> images from my camera by inserting the CF into my laptop, copying them
> and archiving them untouched - but still view them. I intend writing a
> CCD-RAW to PNG converter if I can get the specification.

Try writing to their tech support and ask them if they provide the spec for
3rd party applications. If that doesn't work, see if there's a way to copy
the CCD-RAW file to your hard drive (I don't have the camera so I don't know
how it's done, but it would seem to me that you should be able to copy
anything off a CF card) and try your had at reverse engineering. If I
remember correctly it's 10bpp and I think all that the brains in the TWAIN
driver do is the averaging of each pixel by taking into consideration the
surrounding pixels and coming up with a 24bpp value for each (the same as
the camera would do before compressing to a JPG). Theoretically you could
even devise a better algorithm for a superior final output.

It would be nice if Canon would supply either a DLL or a LIB that would take
the raw data and do the 'conversion' for you so you can write your own
programs with transparancy to the algorithm used, but I highly doubt this is
the case. Even better would be a standard for CCD-RAW that could have a
DLL/LIB for any camera supporting the standard.

Jon Hill

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
> If I
> remember correctly it's 10bpp and I think all that the brains in the TWAIN
> driver do is the averaging of each pixel by taking into consideration the
> surrounding pixels and coming up with a 24bpp value for each (the same as
> the camera would do before compressing to a JPG). Theoretically you could
> even devise a better algorithm for a superior final output.

I think it might be more complicated than this. The Canon CCD records cyan,
magenta, yellow, and green (unlike most digicams which record RGB). So I'm
guessing that the CCD-RAW files contain information on four channels and that
the Canon twain software somehow (???) converts this to RGB.


-jh


Bob Martin

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to

Jon Hill wrote:

Canon do provide a software SDK for people who want to write
their own CRW file software.

Bob

Adam Eberbach

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
In article <3779d3a5...@oldnews.supernews.com>,
lle...@interlog.com says...
> Adam,
> I don't understand your 'problem'. The CCDRAW images are

Here's the problem.

CCD-RAW files can not be viewed - they have to be made into some other
kind of file first. The format offered by Canon is JPEG - a lossy
compression scheme. To be fair, their conversions are good. But, even if
the software you mention can save as PNG it has gone through JPEG first.
Once made into a JPEG, data is gone, forever. To use an audio analogy
it's like copying a CD onto cassette tape and then burning a second CD
using the cassette as source. The best sound quality you will ever have
is that of analog cassette tape, even though the medium is digital CD.

If Irfanview doesn't go through JPEG first then I should look at it and
save myself some work. But I don't think that's the case, given the
files sizes.

If I could convert those files to PNG I would have images that I could
view using Photoshop, or lots of other programs. In ten years I might be
using a system that can't run those Canon drivers - if I have PNG the
worst case is that I have to dig out my graphics file formats book and do
a day's work. Even now there is plenty of sotware I used to use that
Windows NT rejects. If I only have CCDRAW I'll be in deep trouble at
that point. If I stored those images only as JPEG I don't have the
original data.

See what I mean? Canon offer me the choice of

- Lossy compression and convenient viewing.
OR
- No compression, but I have to use their software to convert to JPEG
every time I want to view the images.
OR
- Redundant storage of both the JPEG image and the CCDRAW files to be
able to both view sonveniently and archive without loss. Storage is
cheap, but why waste it?

Kind of like a friend's email .sig - "Bright, early, Peter, pick any
two".

If I could convert to PNG then I could archive images which preserve the
quality of the originals in a form likely to stand the test of time and
also is easily viewed. I'm not set on PNG either - TIFF would be just
fine, maybe even better.

Apart from those reasons I don't want to waste even 3M on their software.
I want ONE image viewing/editing program. ThumbsPlus could thumbnail
those PNGs directly from CD. Photoshop could view them too, and I've
heard Paintshop Pro is excellent. I'm not sure which one I'll buy just
yet, I've not yet had the camera a week.

--
Adam Eberbach

Adam Eberbach

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
Thanks to everyone for advice on what to do about CCD-RAW. I don't care
about being right (and I think now I was wrong about JPEG being a
necessary step in the conversion process), I just want everything to
work!
I have grabbed IrfanView, and will look at it soon - but I think I have
seen output, and it is not up to what I want. It may be time to spring
for Photoshop, and to go the Twain driver route. Annoyingly I can not get
the camera to work with the serial cable... but the CF card works in the
PCMCIA slot. So, images will go to PNG or TIFF before going to their
final resting place on CD.
My Japanese 2.4 TWAIN driver works, but still loads that silly Canon
browser which I had hoped to avoid.
Also it is in Japanese. This would not be so much of a problem if Windows
NT 4.0 could display Kanji, as I am learning, but I hear Win 2000 can do
that.
(I bought the camera in Japan - I live in Australia, where we will
probably be able to buy the A50 for 50% more in about three years time)

--
Adam Eberbach

gb...@my-deja.com

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
In article <MPG.11e1ee654...@news.bigpond.com>,

aebe...@bigpond.com (Adam Eberbach) wrote:
> I'd like to know the file format for this kind of file, so that I can
get
> images from my camera by inserting the CF into my laptop, copying
them
> and archiving them untouched - but still view them. I intend writing
a
> CCD-RAW to PNG converter if I can get the specification.
>
> --
> Adam Eberbach

My guess is that the RAW format is what it is called - raw pixel data
10 bits each. It's probably written in 1024 raws of 1536 pixels without
gaps. The file may also contain some header. I would try to map this
file to the screen and try different offsets from the beginning in case
there is some header. Once you see the correct picture it is easy to
find out where each color is.
Gene.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Triple Quadrophenic

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
In article <MPG.11e22d78e...@news.bigpond.com>, aebe...@bigpond.com
says...

>
>In article <3779d3a5...@oldnews.supernews.com>,
>lle...@interlog.com says...
>> Adam,
>> I don't understand your 'problem'. The CCDRAW images are
>
>Here's the problem.
>
>CCD-RAW files can not be viewed - they have to be made into some other
>kind of file first. The format offered by Canon is JPEG - a lossy
>compression scheme. To be fair, their conversions are good. But, even if
>the software you mention can save as PNG it has gone through JPEG first.

I didn't think that was the case. What I thought was...

If you use the twain interface to import the CCD-RAW file into PhotoShop (PSP,
PP, almost any other pic prog) then the TWAIN driver converts the raw data into
RGB. What then happens to this RGB data depends on how you save it in your pic
prog. If you save it as png, then it will never have undergone jpg compression.

And looking at CCD-RAW files that I've saved as png - I can see no sign of any
jpeg artifacts.

Frank


Phil Askey

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
aebe...@bigpond.com (Adam Eberbach) wrote:

>In article <3779d3a5...@oldnews.supernews.com>,
>lle...@interlog.com says...
>> Adam,
>> I don't understand your 'problem'. The CCDRAW images are
>
>Here's the problem.
>
>CCD-RAW files can not be viewed - they have to be made into some other

They can:

http://www.hamrick.com/upg.html

Download VuePrint.

(Granted not as great as the Canon TWAIN driver, but that's because
Canon haven't (and probably wouldn't) release the exact RGB values for
each colour of the CCD filter)

>the software you mention can save as PNG it has gone through JPEG first.

HUH?

>- No compression, but I have to use their software to convert to JPEG
>every time I want to view the images.

There's no problem, I have CD-RW's *FULL* of CCDRAW files, I can
browse at will and IMPORT at any time I want, they're only 1.9MB which
means I get over 300 *digital CCD negatives* on a CD.

I personally wouldn't want to convert any of my CRW files into another
format which may well be doing some nasty 8-bit RGB translation (note
that CRW's are 10-bits per pixel) and loosing vital picture
information.

--
Phil Askey <ph...@askey.NoSPAM.net>
http://photo.askey.net/

Digital cameras, news, reviews, photography tips, forums,
60 camera comparison database, 850+ photos in the gallery.

(remove NoSPAM to email)

Michael Davidson

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
Bob Martin wrote:
>
> Canon do provide a software SDK for people who want to write
> their own CRW file software.

Yes, but if I remember correctly this is only supplied in
binary form - ie a set of DLL's and some header files for
Windoze ... There are no actual published specifications
of either the serial protocol the camera uses or the CCD-RAW
image format, so this isn't much use if you want to manipulate
your CCD-RAW images on a Linux or Unix system, for example.


Ed Hamrick

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to
Adam Eberbach <aebe...@bigpond.com> wrote:
> I'd like to know the file format for this kind of file, so that I can get
> images from my camera by inserting the CF into my laptop, copying them
> and archiving them untouched - but still view them. I intend writing a
> CCD-RAW to PNG converter if I can get the specification.

Hi Adam,

I've attached the C code I use in VuePrint for reading lines from
.crw files from the Powershot 600, Pro70, and A5. I still need
to add support for the A50, but I suspect it's a simple extension
of the A5.

You're on your own doing color processing (i.e. converting
CMYG to RGB). I haven't gotten a satisfactory 4x3 matrix
yet, but that's all that's needed. I hope to get a good matrix
some day if someone can send me a .crw file taking a
picture in a light box of a Kodak Q60 calibration slide.

Regards,
Ed Hamrick

// CCD Patterns for Canon Powershot cameras are:
//
// 600 A5 Pro 70
//
// GMGMGMGM CYCYCYCY YCYCYCYC
// CYCYCYCY GMGMGMGM MGMGMGMG
// MGMGMGMG CYCYCYCY CYCYCYCY
// CYCYCYCY MGMGMGMG GMGMGMGM
// GMGMGMGM CYCYCYCY YCYCYCYC
// CYCYCYCY GMGMGMGM GMGMGMGM
// MGMGMGMG CYCYCYCY CYCYCYCY
// CYCYCYCY MGMGMGMG MGMGMGMG

#define CRWCCDOFF 26

#define CRWMAXSMP 4096
#define CRWMAXLIN 1552
#define CRWCCDBIA 32

#define CRWCCDWID1 896
#define CRWCCDHEI1 613
#define CRWBMPWID1 854
#define CRWBMPHEI1 612
#define CRWSCAWID1 854

#define CRWCCDWID2 992
#define CRWCCDHEI2 776
#define CRWBMPWID2 960
#define CRWBMPHEI2 768
#define CRWSCAWID2 1024

#define CRWCCDWID3 1552
#define CRWCCDHEI3 1024
#define CRWBMPWID3 1552
#define CRWBMPHEI3 1024
#define CRWSCAWID3 1552

static void InputCRW(XFILE *fil,
int typ,
int wid,
int lin,
short int *buf)
{
int i, j, k;
long t;

// Powershot 600
if (typ == 0)
{
// Lines 0..306 map to 0,2,4,6...612
// Lines 307..611 map to 1,3,5,7...611
t = lin / 2;

if (lin & 1)
t += 307;
}
// Powershot A5 and Pro70
else
{
t = lin;
}

t = CRWCCDOFF+wid*t*10/8;

xseek(fil, t, SEEK_SET);

for (j=0; j<wid/8; j++)
{
unsigned char pix[10];

for (i=0; i<10; i++)
pix[i] = (unsigned char) (xgetc(fil));

k = j*8;

if (typ == 0)
{
buf[k+0] = (short int) ((pix[0] << 2) | ((pix[1] >> 6) & 3));
buf[k+1] = (short int) ((pix[2] << 2) | ((pix[1] >> 4) & 3));
buf[k+2] = (short int) ((pix[3] << 2) | ((pix[1] >> 2) & 3));
buf[k+3] = (short int) ((pix[4] << 2) | ((pix[1] ) & 3));
buf[k+4] = (short int) ((pix[5] << 2) | ((pix[9] ) & 3));
buf[k+5] = (short int) ((pix[6] << 2) | ((pix[9] >> 2) & 3));
buf[k+6] = (short int) ((pix[7] << 2) | ((pix[9] >> 4) & 3));
buf[k+7] = (short int) ((pix[8] << 2) | ((pix[9] >> 6) & 3));
}
else if (typ == 1)
{
buf[k+0] = (short int) ((pix[1] << 2) | (pix[0] >> 6) );
buf[k+1] = (short int) ((pix[0] << 4) | (pix[3] >> 4) );
buf[k+2] = (short int) ((pix[3] << 6) | (pix[2] >> 2) );
buf[k+3] = (short int) ((pix[2] << 8) | (pix[5] >> 0) );
buf[k+4] = (short int) ((pix[4] << 2) | (pix[7] >> 6) );
buf[k+5] = (short int) ((pix[7] << 4) | (pix[6] >> 4) );
buf[k+6] = (short int) ((pix[6] << 6) | (pix[9] >> 2) );
buf[k+7] = (short int) ((pix[9] << 8) | (pix[8] >> 0) );
}
else
{
buf[k+0] = (short int) ((pix[1] << 2) | (pix[0] >> 6) );
buf[k+1] = (short int) ((pix[0] << 4) | (pix[3] >> 4) );
buf[k+2] = (short int) ((pix[3] << 6) | (pix[2] >> 2) );
buf[k+3] = (short int) ((pix[2] << 8) | (pix[5] >> 0) );
buf[k+4] = (short int) ((pix[4] << 2) | (pix[7] >> 6) );
buf[k+5] = (short int) ((pix[7] << 4) | (pix[6] >> 4) );
buf[k+6] = (short int) ((pix[6] << 6) | (pix[9] >> 2) );
buf[k+7] = (short int) ((pix[9] << 8) | (pix[8] >> 0) );
}
}

// Truncate to 10 bits and subtract the bias
for (j=0; j<wid; j++)
{
short int t;

t = (short int) ((buf[j] & 0x3ff) - CRWCCDBIA);

if (t < 0)
t = 0;

buf[j] = t;
}
}


0 new messages