Go to Post Defense is a good thing! - Kevin Sheridan [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 08-02-2010, 15:21
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Displaying Camera Image in C# Dashboard

Dear Cheif Delphi Community,

I know this is a C++ forum, but I dont know anywhere else to post this, but either ways, I am trying to display the camera video on a custom C# form. So far, I have managed to make the the form connect to the camera on the cRIO, and understand that there is data, it even shows the maount of bytes read, ranging from 4(header and size) to 9000(I dont know), this is my current code:

Code:
if (netStream.DataAvailable)
                {
                    image.indicator.Text = "Data Available";
                    //image.videoStream.Image = Image.FromStream(netStream);
                    data = new byte[serverClient.ReceiveBufferSize];
                    
                    bytesRead = netStream.Read(data, 0, serverClient.ReceiveBufferSize);
                    //tw.WriteLine(DateTime.Now + " " + bytesRead.ToString());
                    if (bytesRead > 100)
                    {
                        try
                        {
                            MemoryStream ms = new MemoryStream(data);
                            image.videoStream.Image = Image.FromStream(ms, false, true);
                        }
                        catch (Exception ex)
                        {
                            tw.WriteLine(DateTime.Now + ex.ToString());
                        }
                    }
                }
                else if (!netStream.DataAvailable)
                {
                    image.indicator.Text = "No Data Available";
                }
Whoever knows C#, the Image.FromStream() method keeps returning a Parameter is Invalid in the excetion. Obviously I think that data(the byte[] array that stores the image data] is corrupt or something, I do not know though. Can anyone please show me some proper code here for displaying the image, btw I know the program is connected because the status label does read Data Available.
Reply With Quote
  #2   Spotlight this post!  
Unread 08-02-2010, 15:35
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Displaying Camera Image in C# Dashboard

the data is not an image stream like the one .Net is expecting. I am not sure what the encoding is, but you will need to (I think) capture the data one frame at a time (yes, manually) and convert that to a .Net Image
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #3   Spotlight this post!  
Unread 08-02-2010, 16:07
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Re: Displaying Camera Image in C# Dashboard

That is what it is doing, capture ONE image at a time and displaying it, and netStream is not a .NET Image Stream, it is a network stream, and it reads data from a socket, the only thing remotely related or used for creating the image is data(byte[]) that stores the image data in byte form, MemoryStream ms, which is used to store data and then get the Image form the stream, Image.FromStream(ms); . Like I said before, it also shows that there is data available on the stream, it is just the stupid Image.FromStream() keeps returning an Parameter is Invalid in its exception. I dont know what to do at this point.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-02-2010, 16:15
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Displaying Camera Image in C# Dashboard

I'd recommend looking at the LabVIEW dashboard code, and see if it happens to mention what kind of image its expecting.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #5   Spotlight this post!  
Unread 08-02-2010, 16:26
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
  #6   Spotlight this post!  
Unread 08-02-2010, 16:32
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Re: Displaying Camera Image in C# Dashboard

The Dashboard Code from LabVIEW doesnt help at all , ive read through the whole thing countless times, the PCVideoServer.cpp I have also read through that code,infact I am sitting right in front of it lol, that is why there is a if(readBytes > 1000) code, it makes sure I am not sending the header or imageSize as parameters to the MemoryStream, actually after much testing, i got the image to display at about .01 fps rofl, it updates the image irregularly and it is lagging BEYONG belief, here is my current code for that image processing:

Code:
if (netStream.DataAvailable)
                {
                    image.indicator.Text = "Data Available";
                    //image.videoStream.Image = Image.FromStream(netStream);
                    data = new byte[serverClient.ReceiveBufferSize];
                    
                    //bytesRead = netStream.Read(data, 0, serverClient.ReceiveBufferSize);
                    bytesRead = client.Receive(data, 0, serverClient.ReceiveBufferSize, 0);
                    //tw.WriteLine(DateTime.Now + " " + bytesRead.ToString());
                    if (bytesRead > 1000)
                    {
                        try
                        {
                            MemoryStream ms = new MemoryStream(data);
                            image.videoStream.Image = Image.FromStream(ms, false, true);
                        }
                        catch (Exception ex)
                        {
                            tw.WriteLine(DateTime.Now + ex.ToString());
                        }
                    }
                }
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2010, 16:38
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

Quote:
Originally Posted by PranavSathy View Post
The Dashboard Code from LabVIEW doesnt help at all , ive read through the whole thing countless times, the PCVideoServer.cpp I have also read through that code,infact I am sitting right in front of it lol, that is why there is a if(readBytes > 1000) code, it makes sure I am not sending the header or imageSize as parameters to the MemoryStream, actually after much testing, i got the image to display at about .01 fps rofl, it updates the image irregularly and it is lagging BEYONG belief, here is my current code for that image processing:
The problem is that you're just randomly grabbing chunks of data > 1000 bytes in length, throwing it into an image, and hoping that everything lines up correctly.

I would recommend reading 8 bytes first, and look for the 0x01,0x00,0x00,x00 header in the first 4. If that's there, read the length from the next 4 bytes. Then, read in that number of bytes from your networkstream, and pass it into Image.FromStream(). Repeat.
__________________
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
  #8   Spotlight this post!  
Unread 08-02-2010, 16:46
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Displaying Camera Image in C# Dashboard

What I meant was that the data you are giving image.fromstream is NOT in the format it accepts.
ex:
asdfghjkl is the image data it expects, and you are sending it something else, like 10000009asdfghjkl or a different encoding (but it should be fine if it is a JPEG)
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #9   Spotlight this post!  
Unread 08-02-2010, 16:47
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Re: Displaying Camera Image in C# Dashboard

I hope you dont mind me asking, but can you give me the example for the code for that, becuase from what I have logged, as in BYTES READ, the amount varies, this what an example would look like, this is from my log file:
Code:
2/9/2010 4:53:35 AM StartStream()
2/9/2010 4:53:35 AM Connecting!
2/9/2010 4:53:35 AM Connected
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 7867
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8009
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8039
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8003
2/9/2010 4:53:36 AM 4384
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 3649
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 7995
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 2032
2/9/2010 4:53:36 AM 6001
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8040
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 6412
2/9/2010 4:53:36 AM 1620
2/9/2010 4:53:36 AM 4384
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 3657
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8041
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8061
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8040
2/9/2010 4:53:36 AM 4384
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 3631
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 7984
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8011
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8033
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8057
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8062
2/9/2010 4:53:36 AM 4
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8084
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 4948
2/9/2010 4:53:36 AM 3128
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8073
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8037
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 8025
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 572
2/9/2010 4:53:36 AM 4380
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 568
2/9/2010 4:53:36 AM 8192
2/9/2010 4:53:36 AM 2329
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8000
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7988
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8002
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8000
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8026
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8017
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 4952
2/9/2010 4:53:37 AM 3053
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 8009
2/9/2010 4:53:37 AM 4384
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 3589
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 572
2/9/2010 4:53:37 AM 7400
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7926
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 2032
2/9/2010 4:53:37 AM 5880
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7911
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7954
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7905
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 6412
2/9/2010 4:53:37 AM 1515
2/9/2010 4:53:37 AM 5785
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 2108
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7842
2/9/2010 4:53:37 AM 4384
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 3438
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7828
2/9/2010 4:53:37 AM 4380
2/9/2010 4:53:37 AM 4380
2/9/2010 4:53:37 AM 7300
2/9/2010 4:53:37 AM 4384
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 3361
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7676
2/9/2010 4:53:37 AM 8
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7656
2/9/2010 4:53:37 AM 4384
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 3187
2/9/2010 4:53:37 AM 4
2/9/2010 4:53:37 AM 8192
2/9/2010 4:53:37 AM 7611
2/9/2010 4:53:38 AM 4
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7574
2/9/2010 4:53:38 AM 4380
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 3255
2/9/2010 4:53:38 AM 4384
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 3259
2/9/2010 4:53:38 AM 4384
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 3321
2/9/2010 4:53:38 AM 4384
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 2028
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 747
2/9/2010 4:53:38 AM 4384
2/9/2010 4:53:38 AM 4380
2/9/2010 4:53:38 AM 7229
2/9/2010 4:53:38 AM 4
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7908
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7895
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 572
2/9/2010 4:53:38 AM 7201
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 2032
2/9/2010 4:53:38 AM 4380
2/9/2010 4:53:38 AM 1305
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7646
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7553
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7481
2/9/2010 4:53:38 AM 4
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7335
2/9/2010 4:53:38 AM 4384
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 2860
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7272
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 4952
2/9/2010 4:53:38 AM 2333
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7233
2/9/2010 4:53:38 AM 4
2/9/2010 4:53:38 AM 8192
2/9/2010 4:53:38 AM 7198
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7137
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 685
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 3488
2/9/2010 4:53:39 AM 5840
2/9/2010 4:53:39 AM 1814
2/9/2010 4:53:39 AM 4380
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 1766
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 568
2/9/2010 4:53:39 AM 5664
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 6239
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 6213
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 6330
2/9/2010 4:53:39 AM 4384
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 2058
2/9/2010 4:53:39 AM 4380
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 2055
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 4380
2/9/2010 4:53:39 AM 4380
2/9/2010 4:53:39 AM 5916
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 2032
2/9/2010 4:53:39 AM 4522
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 6799
2/9/2010 4:53:39 AM 4384
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 2769
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7424
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7716
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7880
2/9/2010 4:53:39 AM 4384
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 3548
2/9/2010 4:53:39 AM 4384
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 3523
2/9/2010 4:53:39 AM 4384
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 3544
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7927
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7917
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 7926
2/9/2010 4:53:39 AM 4
2/9/2010 4:53:39 AM 4380
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 3526
2/9/2010 4:53:39 AM 8192
2/9/2010 4:53:39 AM 6408
2/9/2010 4:53:40 AM 4380
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 5071
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 6408
2/9/2010 4:53:40 AM 1520
2/9/2010 4:53:40 AM 4
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 4948
2/9/2010 4:53:40 AM 2999
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7915
2/9/2010 4:53:40 AM 4384
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 3566
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7934
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7942
2/9/2010 4:53:40 AM 4
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7949
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7984
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 2032
2/9/2010 4:53:40 AM 4380
2/9/2010 4:53:40 AM 1543
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7942
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 4952
2/9/2010 4:53:40 AM 3031
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 3488
2/9/2010 4:53:40 AM 4464
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 4948
2/9/2010 4:53:40 AM 3016
2/9/2010 4:53:40 AM 4380
2/9/2010 4:53:40 AM 4380
2/9/2010 4:53:40 AM 7416
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 7957
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 3492
2/9/2010 4:53:40 AM 4488
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 4948
2/9/2010 4:53:40 AM 3051
2/9/2010 4:53:40 AM 8192
2/9/2010 4:53:40 AM 2028
2/9/2010 4:53:40 AM 5926
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7974
2/9/2010 4:53:41 AM 8
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7734
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 3492
2/9/2010 4:53:41 AM 4510
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7868
2/9/2010 4:53:41 AM 90
2/9/2010 4:53:41 AM 4380
2/9/2010 4:53:41 AM 4380
2/9/2010 4:53:41 AM 7442
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 4948
2/9/2010 4:53:41 AM 2989
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7868
2/9/2010 4:53:41 AM 135
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7868
2/9/2010 4:53:41 AM 101
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 8013
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7992
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 2028
2/9/2010 4:53:41 AM 4380
2/9/2010 4:53:41 AM 1558
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7991
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7956
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7970
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7978
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7976
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 6408
2/9/2010 4:53:41 AM 1576
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7970
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 2032
2/9/2010 4:53:41 AM 5905
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7977
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7973
2/9/2010 4:53:41 AM 4384
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 3563
2/9/2010 4:53:41 AM 4
2/9/2010 4:53:41 AM 8192
2/9/2010 4:53:41 AM 7962
2/9/2010 4:53:42 AM 4384
2/9/2010 4:53:42 AM 8192
2/9/2010 4:53:42 AM 3590
2/9/2010 4:53:42 AM 8192
2/9/2010 4:53:42 AM 572
2/9/2010 4:53:42 AM 7396
2/9/2010 4:53:42 AM 8192
2/9/2010 4:53:42 AM 8017
2/9/2010 4:53:42 AM 4384
2/9/2010 4:53:42 AM 8192
2/9/2010 4:53:42 AM 3634
As you can see, there is no consistency to where the 4 is. Also , these numbers are the amount of bytes read

Last edited by PranavSathy : 08-02-2010 at 16:54.
Reply With Quote
  #10   Spotlight this post!  
Unread 08-02-2010, 16:58
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Displaying Camera Image in C# Dashboard

depending on the image, the size varies, because JPEG is a compressed format
for example, a pure black image will be much smaller than a picture where every pixel is a different color
Edit: look at the attachment sizes
Attached Thumbnails
Click image for larger version

Name:	test.jpg
Views:	8
Size:	1.1 KB
ID:	8560  Click image for larger version

Name:	plasma.jpg
Views:	13
Size:	47.2 KB
ID:	8561  
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib

Last edited by byteit101 : 08-02-2010 at 17:02. Reason: added sample
Reply With Quote
  #11   Spotlight this post!  
Unread 08-02-2010, 17:00
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Re: Displaying Camera Image in C# Dashboard

Ok, even with a code that just read 8 bytes at a time, not a single string that I printed into the log had a NUMBER or a 0x00 or whatever the header was, they were all messed up jumbles of characters. I honestly am stuck here, as the image displays once and then doesnot update for anotehr few minutes, then updates, few minutes, one more frame, few minutes, one more frame etc. on and on.
Reply With Quote
  #12   Spotlight this post!  
Unread 08-02-2010, 17:04
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Displaying Camera Image in C# Dashboard

look at it in a byte array, you should see a 1 then 0 0 0 etc...
in a string, this would be a box followed by \0\0\0 (but only in the debugger, output is cut by \0
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #13   Spotlight this post!  
Unread 08-02-2010, 17:06
PranavSathy PranavSathy is offline
Team Captain
AKA: Pranav Sathyanarayanan
FRC #0263 (Sachem Aftershock)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Holbrook, New York
Posts: 27
PranavSathy is an unknown quantity at this point
Re: Displaying Camera Image in C# Dashboard

I did :d, I went through the entire output, I simple just wrote the entire byte array as a string into the log file, there was no 1\0\0\0 in the whole log file.

I also looked for \0. I found one of those in every output, as expected, but not in the beginning of the byte array, they were found near the middle of each one. Also only a few of them were followed by a number like 5, or 4, or 7.

Last edited by PranavSathy : 08-02-2010 at 17:11.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Labview Dashboard not displaying camera. GunfighterJ NI LabVIEW 1 02-02-2010 19:20
Reinstall of dashboard doesn't fix camera image streaming ellisk Programming 2 20-01-2010 08:04
[Help Needed] Camera to Dashboard basicxman C/C++ 1 19-01-2010 18:20
Can we use the camera image on Dashboard this year? Jon236 Programming 1 11-01-2010 12:52
Only Camera works in Dashboard keehun Programming 1 06-01-2009 07:22


All times are GMT -5. The time now is 13:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi