CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Viewing serial images

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

Viewing serial images
PostPosted: Fri Feb 11, 2011 7:18 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 8:27 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 9:47 am     Reply with quote

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

View user's profile Send private message

4d uCam Serial Jpeg Camera
PostPosted: Fri Feb 11, 2011 11:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 11:24 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Feb 11, 2011 11:56 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 3:41 pm     Reply with quote

Surely you meant byte 5 Smile 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: 19515

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 4:16 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Feb 11, 2011 8:04 pm     Reply with quote

jacqueskleynhans wrote:
Surely you meant byte 5 Smile 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.

Smile
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

PostPosted: Sat Feb 12, 2011 10:48 am     Reply with quote

ahhh of course you got me Smile 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

View user's profile Send private message

images
PostPosted: Mon Feb 14, 2011 1:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Feb 15, 2011 9:35 am     Reply with quote

bump
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 8:17 am     Reply with quote

@ 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"
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group