View previous topic :: View next topic |
Author |
Message |
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
Viewing serial images |
Posted: Fri Feb 11, 2011 7:18 am |
|
|
HI guys how do I view jpeg image data from a serial camera. Can can send the data out as hex or dec or convert it in matlab to bin. But I cant view it or rather don't know how to. Its kinda easy for me to work in raw but yea I'm kinda stuck. I have tried saving it as a jpg in hex and bin but nope.
bin in this format
Quote: | 0 0 1 0 0 0 0 1
1 0 1 1 0 0 0 0
1 1 1 1 0 0 0 1
0 0 1 0 0 1 0 0
1 0 0 1 0 1 0 1
1 0 1 1 0 0 0 0
0 0 0 0 1 1 0 1
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 0 0 1 1 1 1
0 1 1 1 0 0 0 1
1 0 1 0 0 1 0 0
1 1 1 1 0 0 1 0
0 0 1 1 0 0 0 0 |
and hex is also a column vector
Any help please thx !!
Have a good wknd _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Feb 11, 2011 8:27 am |
|
|
You need to start with the data sheet for the camera.
You say 'jpeg', but what you post, is not the start of a jpeg image. Jpeg begins with a FFD8 SOI marker.
So, you have _zero_ hope of progressing, till you know what the camera actually generates. You need _data_.
Best Wishes |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Feb 11, 2011 9:47 am |
|
|
It would also help if the camera put out an uncompressed image like a .bmp instead of a compressed .jpg image. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
4d uCam Serial Jpeg Camera |
Posted: Fri Feb 11, 2011 11:18 am |
|
|
the camera I am using can be seen here: http://www.4dsystems.com.au/downloads/micro-CAM/Docs/uCAM-DS-rev4.pdf
I have written most of the code but still have hang ups with the actual viewing of the images...
Ttelmah The marker you spoke of FFD8 SOI marker .... didnt come accross it in the data sheet..
The camera can also put out uncompress "RAW" but i want to get the jpeg going first.
Can you maybe check in the data sheet and tell me what you think about the jpeg.
Kindest Regards
Jacques _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Fri Feb 11, 2011 11:24 am |
|
|
I must also add what I'm currently doing is removing the "data" from the package and sending only it to the computer from the pic. The package can bee seen on pg10. Or do I have to send the entire package ??
Thx _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Fri Feb 11, 2011 11:56 am |
|
|
The JPEG image, starting with the header, should be contained within the image data portion of the data packages. You'll need to extract that data and assemble it all into one JPEG file. So for each data package you would need to do the following:
- Checksum the whole package, less the last two bytes.
- Compare this value to the last two bytes. If they don't match, send NAK and start over. You can skip this part, but might end up with corruputed images if you get any bad packets.
- Strip off the first 4 bytes and the last 2.
- Save the remainder (the data portion) as part of the JPEG image file.
- Send an ACK to get the next package.
Knowing this, you should see the image file starting with byte 4 of the first package. Also, remember that when sending to the PC you need to make sure you're sending all 8 bits and receiving it as binary data on the PC side. If you let the PC treat it as ASCII, it's not going to work. |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Fri Feb 11, 2011 3:41 pm |
|
|
Surely you meant byte 5 of the first package. I will try this thx for the help.
Regards _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Feb 11, 2011 4:16 pm |
|
|
Thankfully your camera has a 'RAW' mode, as well as JPEG. Probably about 50* less work to use this than JPEG....
The full jpeg format, has a 'marker' segment, which begins with the SOI marker. Then an APPO segment, that has an FFE0 signature, then the length, a 'JFIF' text marker, and the picture version/dimensions. Then there are segments carrying the details of the Huffman table used in the encoding etc..
This data is needed to decompress the jpeg.
Seriously, I'd say it'd be much easier to operate the camera in raw mode, and just add the header so the PC can handle it as a bitmap.
Best Wishes |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Fri Feb 11, 2011 8:04 pm |
|
|
jacqueskleynhans wrote: | Surely you meant byte 5 of the first package. I will try this thx for the help.
Regards |
No, I meant byte 4. Assuming you count them starting with zero like a civilized person.
|
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Sat Feb 12, 2011 10:48 am |
|
|
ahhh of course you got me was just testing hehe.
I will look into the things you mentioned.
Thx again _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
images |
Posted: Mon Feb 14, 2011 1:25 am |
|
|
Hi Still struggling with the jpeg data...
if the total packet which is seen on pg10
<ID2B><DataSize2B><Image Data 58B><verify code2B>
Then After I store the packet in a array I send the data to a computer like this.
Code: |
for(n = 3; n<count ; n++)
{
fputc(packet_buffer[n],DEBUG);
delay_us(1);
}
|
count = default size 64Bytes - 6bytes = 58bytes.
Thx
Jacques _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Tue Feb 15, 2011 9:35 am |
|
|
bump _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Wed Feb 16, 2011 8:17 am |
|
|
@ Ttelmah
I have verified that my image data contains all the JFIF markers except the end marker. So I think I am cutting the last packet short. Don't know why though.
Jacques _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
|