View Single Post
  #5   Spotlight this post!  
Unread 02-08-2010, 04:26 PM
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: Displaying Camera Image in C# Dashboard

From looking at the PCVideoServer source code, it looks like there is a header with the four bytes 0x01, 0x00, 0x00, 0x00, followed by 4 more bytes representing the size of the image as a 32-bit integer. The image is sent as a JPEG.

Code:
success = AxisCamera::GetInstance().CopyJPEG(&imageData, numBytes, imageDataSize);
...
// Write header to PC
static const char header[4]={1,0,0,0};
int headerSend = write(newPCSock, const_cast<char*>(header), 4);
// Write image length to PC
int lengthSend = write(newPCSock, reinterpret_cast<char*>(&numBytes), 4);
// Write image to PC
int sent = write (newPCSock, imageData, numBytes);
It would seem to me that you're passing in those header bytes into Image.FromStream() and that's why it isn't working. Try to use the header information to your advantage. It will mark when an image begins and its length.
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
Reply With Quote