Make your own free website on Tripod.com

I stopped working on this project in 2001.
Luckily for you, gPhoto continued it.
They now support a number of cameras with the chipset.
They seem to have binaries for Linux and for Mac OSX.

Intro:

This page is part of a contribution to gPhoto.org.
It is part of my effort to help give the Polaroid Fun Digital 320  Linux support.
I am now a maintainer of the code for the Polaroid Fun! 320 and the Polaroid 640SE.
We were getting close, but we are not quite done yet.
The colors are currently screwed up and the image is half the height it is supposed to be.
This camera is much like the Polaroid 640SE (and perhaps others in the line) so you can get some info from http://www.dogphilosophy.net/photo/polaroid.html (which seems to be dead right now) or the old location at http://www.2xtreme.net/dubious/photo/polaroid.html.

The camera's plug:

A number of people have asked me where they can get a plug for this camera.
I don't know where else than Polaroid you could get a replacement plug, but here is how to make one.
You need a serial plug (perhaps from a broken mouse) and a stereo plug (perhaps from a busted set of headphones).
Here is a simple sketch of how to connect the wires.

About the official software:

While looking at the software that came with my Polaroid camera, I noticed some things.
It says PhotoMAX Fun! Digital 320 Creative Kit on the front of the package.
The Window software saves the Polroid 320's pics in 24 bit BMP files.
24 bit BMP files have no compression so they will all be 225.05K.
When selecting an image source to get images from, it says the following:
Polaroid Digital 320 Camera <--------what I need to select
Polaroid Fun!Flash Digital Camera
Polaroid PDC 640 or PDC 1000
Polaroid PDC700 Digital Camera

Here is a driver that will work for Windows 95/98/Me/2000/XP.
If that does not work, here is their help customer service page.

The image flaw of the official software:

Here is a 48x48 blowup of one of the flawed BMP files.
The BMP files that the Windows software makes is rather blocky (16x16 blocks).
Because of these blocks, there is more detail in red than green than blue.
If we can adjust for this, the pictures will look better than the Windows software makes.

There is also a problem of those annoying little dots.
I imagine those could be smoothed out by about any graphics program.

Wine?:

I am not sure if the Wine program may be of use in running this camera or not.
If someone would like to try, email gPhoto so that we can here all about it.
Honestly, I think the need for the Twain drivers will make that impossible.
Hopefully, we will complete the gPhoto driver soon so that you you would not have to run any Windows software to get pictures off of the camera.

This project:


I can currently download Polaroid Fun! 320 images with bad colors via the gphoto2 program that is in cvs.
The image names might not be set correctly though.
It could be PDC320*.raw instead of PDC320*.jpg.
The SourceForge.net page is here.
You can browse the code that we have in cvs from there.
I know the Polaroid 320 and the Polaroid 640SE send the image as JPEG data.
I am not sure what other Polaroid 640's do though.
We were stuck for a while on the data for the image itself until we got a submission from Karl Grill that told us how to modify an existing jpeg header and use it for the camera.
We still have some of work to do on figuring out how to make proper jpeg files from the camera data.
The catch is, it might store YUV (or something) instead of RGB.
I think it could be that the image is RGB, but it uses a 16x8 block of pixels after the normal image data to help correct the color.
The data sent by the camera seems to between 1K and 3K.
Good thing we will be making jpeg files instead of BMP files. The chipset is Xirlink's XP 8052A and has some Efite MT LP61 10085-12 chip (probably flash) in it too.

Using Portmon, me and the other people on this project have discovered some interesting things about our cameras.
The 320 camera seems to have a sending buffer of 2000 bytes.
I am sure the 640 cameras have different sizes for their sending buffers.
When asked for ID, this 320 of mine returns "00 XIRLINK 02 01 03 00 16 C0".
What exactly that means, I don't know (yet).
Without knowing what it all means, I figured this much out.
Here is a bit of C sourcecode to get the raw picture data out of the camera and here is my backup copy.
The program was written by Peter Desnoyers.
It does not make a jpeg file, but it might later if we use this new knowledge of ours in it.

Here is the new knowledge that Karl Grill gave us mixed in with some things I figured out:

The data at offset 163 (0xA3) should be changed to 00 78 01 40 for the 320, or to 00 f0 02 80 for the 640se.
That data at offset 163 has to do with the width and height of the image.
The data at offset 169 (0xA9) should be changed to 21 00 02 11 00 03 11 00 to set the proper subsampling rates and to change the quantization tables (the latter may not be necessary).
Although it may seem odd, I found that 11 00 02 21 00 03 11 00 works alot better for the 320.
The 21 is when doing 2x1,1x1,1x1 subsampling and should be changed to 22 for 2x2 or 11 for 1x1.
The data at offset 616 (0x268) should be changed to 02 00 03 00 to set the proper Huffman tables.
Just chop off everything but the first 623 bytes (the header).
Now, take this 623 Byte header, and concatenate it with the raw data, from which the first 6 bytes have been chopped off.
The result is a jpg file which is read by a viewer without complaint.
I used sample1.jpg from http://www.2xtreme.net/dubious/photo/640se.html.
That is also what Karl Grill did.
Here is the header from sample1.jpg modified to fit the PDC 320 camera.
I imagine experimenting with headers from different jpeg files will be done.
I wrote jpeg.txt to assist anyone trying to figure out how to make a better header.
If any of the information is wrong or you have something to add or clear up, email me.
I wrote dat2jpg.c to make a jpeg file from the dat file that pdc320 shoots out.
Unfortunately, dat2jpg.c can't handle it when there is a comment in the jpeg you give it for a header source.
Gimp for example, adds a comment to the images by default.
I wrote splitrgbdemo.sh to help debug the colors of a jpeg file, but it seems like the resulting green layer from that is inverted.
Those should help anyone who wants to try patching different jpeg files to get trial headers for use with the camera.

The left image is from the proper methods.
The middle image is from adding a patched header.
The right image is from patched header attempts and image manipulation.
Here is the actual BMP file that came out of the PhotoMax software.

Karl Grill suggested that I start looking at the jpeg lib and see how to use it so that perhaps I could take the raw data and decode it properly.
Sounds like a good idea to me. Anyone else want to do the same?

Latest efforts:

I have found out that while the pattern "11 00 02 21 00 03 11 00" above works and makes nice looking images, the colors are off.
The pattern "11 01 02 11 00 03 21 00" seems to have more accurate color, but some other flaws.
I have decided to use the jpeg header tables from a jpeg file that was created by the Polaroid 640SE Windows software.
I need to work on the quantization tables some because there is a slight doubled appearance to the edges of the objects in the images.

Here are some more recent attempts using the new pattern:
Home