Go to Post As everyone knows, our students don't actually design or build the robot, so to make it look like they were working on it for the video, we hid cookies inside the unfinished frame and turned them loose. It looks believable. - Mike Soukup [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2009, 20:00
s0crates s0crates is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2009
Location: Australia
Posts: 52
s0crates is on a distinguished road
c++ from labview?

Is it possible to acquire images on the cRIO in c++ and then process them in labview?

-jonathan
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2009, 21:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: c++ from labview?

It is possible to call binary libraries, .out files from LV, but you should have a very good grasp pointers and perhaps even memory management before trying.

Why not use the icons to get images in LV?

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 22-02-2009, 11:42
s0crates s0crates is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2009
Location: Australia
Posts: 52
s0crates is on a distinguished road
Re: c++ from labview?

Quote:
Originally Posted by Greg McKaskle View Post
Why not use the icons to get images in LV?

Greg McKaskle
Labview is slower. Additionally, c/c++ already is being used within the image acquisition process to decode the jpeg image received.

Do you know how much overhead is incurred when passing the image into the dll and back into labview?

I have had experience with c/c++; we're using labview because we think it's easier and development is faster. It looks like if the entire image acquisition process was handled by c++ code, fewer resources would be used since the image would be handed off only once. It would also be easier to use the mjpg method already implemented in c++, rather than rewriting that in labview (and finding/compiling a lib that has support for progressive jpg - unless I'm mistaken, the images in the mjpg stream are progressive and cannot be handled by the library function called by labview).

thx,
-jonathan
Reply With Quote
  #4   Spotlight this post!  
Unread 22-02-2009, 16:10
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: c++ from labview?

Quote:
Labview is slower. Additionally, c/c++ already is being used within the image acquisition process to decode the jpeg image received.

Do you know how much overhead is incurred when passing the image into the dll and back into labview?
So, how did you reach that conclusion? Both LV and the WPI C/C++ code call into the same exact .out file. They pass in a pointer to a string buffer and an image pointer where they'd like the pixels to be stored. They have the same overhead which is minimal. Similarly, the image processing is making calls into the .out to carry out color thresholds, particle reports, etc. Again, the overhead will be the same, minimal. The heavy lifting of per pixel work is already written and tuned and in the .out.

Quote:
I have had experience with c/c++; we're using labview because we think it's easier and development is faster. It looks like if the entire image acquisition process was handled by c++ code, fewer resources would be used since the image would be handed off only once. It would also be easier to use the mjpg method already implemented in c++, rather than rewriting that in labview (and finding/compiling a lib that has support for progressive jpg - unless I'm mistaken, the images in the mjpg stream are progressive and cannot be handled by the library function called by labview).
The image is just a pointer. Passing it as a parameter means passing just four bytes. If you were doing this in C++, you'd be using a pointer too, four bytes pointing to thousands of pixels. No difference in performance.

The C++ code uses a different TCP command to get the images from the camera. Initially LV used the same, but later switched to SW timed acquisition. I've compared them side-by-side, and they are different but equivalent. If there'd been time, both languages would have supported both techniques for getting the images. Here are the tradeoffs.

The MJPG has the advantage of keeping a TCP session alive and having the camera decide when to start acquiring each image. It has the disadvantage of letting the camera send more images than you can process, leading to a TCP buffer of many images, which will appear as a lag between things happening in the real world and when sensed by the robot. This happened again and again during prototyping. The WPI C implementation keeps a parallel task running to consume the TCP traffic even if you don't use the results. This should keep the buffer emptied.

The LV code requests a JPEG, and the camera responds and closes the session each time. The disadvantage then is a small amount of additional TCP overhead. The advantage is that there cannot be any buffered images as the cRIO initiates the image acquisition. The TCP overhead wasn't noticeable in side by side tests.

The images returned from the camera are not progressive. Whether the program requests an mjpg or jpeg, each image will arrive as a single packet containing a jpeg frame. The exact same decode call is made to parse the jpeg stream and turn it into image pixels.

There are plenty of differences, but performance really isn't one of them. I hope this helped. Any other reasons why LabVIEW is slower?

Better yet, any measurements?
Greg McKaskle
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
Saving images/video from camera (LabVIEW) Chaos in a Can NI LabVIEW 3 16-08-2010 16:21
Calling C/C++ from LabVIEW Goldfire Programming 3 07-02-2009 10:59
Trouble downloading from LabView MikePres NI LabVIEW 9 24-01-2009 08:53
Trouble Downloading from LabView to cRio MikePres FRC Control System 0 15-01-2009 16:17
LabView installation from package from FIRST Skipwich NI LabVIEW 6 04-12-2008 21:26


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

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