Go to Post Breathe in and out.... *altoids mint* breathes in more... *looks at countdown until kickoff*...30 DAYS!!! *competition anxiety disorder* - Conor Ryan [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

 
 
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-08-2010, 03:21 PM
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
 


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 07:20 PM
Reinstall of dashboard doesn't fix camera image streaming ellisk Programming 2 01-20-2010 08:04 AM
[Help Needed] Camera to Dashboard basicxman C/C++ 1 01-19-2010 06:20 PM
Can we use the camera image on Dashboard this year? Jon236 Programming 1 01-11-2010 12:52 PM
Only Camera works in Dashboard keehun Programming 1 01-06-2009 07:22 AM


All times are GMT -5. The time now is 10:37 AM.

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