Go to Post Picking up tetra's is going to be as easy as picking up a person of the opposite sex. While a select few will master it; others will be bumbling maroons.. - Elgin Clock [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 18-02-2016, 19:21
Lorenzo334's Avatar
Lorenzo334 Lorenzo334 is offline
Lorenzo Guerra
AKA: Lorenzo
FRC #4063 (TRikzR4kidz)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Del Rio, TX
Posts: 10
Lorenzo334 is an unknown quantity at this point
Help with two USB Cameras on the Dashboard.

Hello,

We have been tasked with the job to program two HD Microsoft USB cameras. With a possibility of showing them both at the same time on the dashboard. I understand this might be a problem with the limited information we can send though wifi. Our superiors believe that if we lower the FPS, compression, and the image size we might be able to send two images at the same time, I trust in their experience so I'm pretty confident we can do this.

We went ahead and looked for other vision codes on this website and we found one, the one attached. The only problem is that it is from 2015, so if there is anyway of converting the program to 2016 it would help, or someone explain what we need and don't need, or if someone has an updated and/or better version.

That would help. If you need more information or any questions about our question please do ask and help us out.

Thank you,

Lorenzo Guerra and
Team 4063 Programming Team
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	104
Size:	316.9 KB
ID:	20111  
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2016, 11:29
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,748
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: Help with two USB Cameras on the Dashboard.

The attached picture is a modified version of WPI_CameraSendImages To PC Loop. If you have the VI, put it in with the rest of your code -- perhaps next to RobotMain. Then drag it to the project window so that it is listed there.

In the Vision Processing VI, comment out or delete the Background block and call the new VI instead by dragging it from the project to the Vision Processing diagram.

Post again if that doesn't work.
Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2016, 13:23
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,156
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: Help with two USB Cameras on the Dashboard.

If lab view is the same as Java/c++, you are going to have trouble. The camera server (routines) are only designed for 1 camera.

If your second camera is an ip camera, you can open a browser window and get the image directly. There may be a way to access a sub camera directly, but I have no idea how
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2016, 15:06
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,748
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: Help with two USB Cameras on the Dashboard.

The code that the student attached is the video server.

The default one in WPILib serves one camera, the one posted opens sessions to two USB cameras and serves images from one of them. To further modify it to interleave the images on one port or to open a second port is just a bit more code. So teams are given the source to the video server and it is theirs to expand provided they don't bypass the bandwidth limits.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2016, 16:06
Lorenzo334's Avatar
Lorenzo334 Lorenzo334 is offline
Lorenzo Guerra
AKA: Lorenzo
FRC #4063 (TRikzR4kidz)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Del Rio, TX
Posts: 10
Lorenzo334 is an unknown quantity at this point
Re: Help with two USB Cameras on the Dashboard.

Thank you,

For posting your responses, Mr. McKaskle when you say "In the Vision Processing VI, comment out or delete the Background block and call the new VI instead by dragging it from the project to the Vision Processing diagram." What do you mean?

Thank you again both of you for responding to the thread. Once we fully make this program functional we will post back, and vise versa if the program does not work.
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2016, 18:12
Lorenzo334's Avatar
Lorenzo334 Lorenzo334 is offline
Lorenzo Guerra
AKA: Lorenzo
FRC #4063 (TRikzR4kidz)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Del Rio, TX
Posts: 10
Lorenzo334 is an unknown quantity at this point
Re: Help with two USB Cameras on the Dashboard.

Okay,

So we put the program into place and we found that there is too much data so the driverstation is shutting down the flow of information to the other camera feed or it doesn't show it at all and then the cycle continues, it goes from 9E-5 Mbps to 0 Mbps then to 8E-5 Mbps.

So here is the program showing all of the case structures and their sub-cases. If there are any problems please help us.

Thank you,

Lorenzo Guerra and
Team 4063 Programming
Attached Thumbnails
Click image for larger version

Name:	USB cameras Error.PNG
Views:	44
Size:	27.6 KB
ID:	20114  Click image for larger version

Name:	USB cameras.PNG
Views:	54
Size:	56.5 KB
ID:	20115  Click image for larger version

Name:	USB cameraslocalhost.PNG
Views:	40
Size:	36.8 KB
ID:	20116  
Reply With Quote
  #7   Spotlight this post!  
Unread 21-02-2016, 09:33
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,748
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: Help with two USB Cameras on the Dashboard.

Thanks for asking. Here is what I meant.

The attached image shows the part of the Vision Processing block diagram that calls the Background block -- actually it is called the WPI_CameraBackground Loop.vi.
That VI does two background tasks:
1.) For Axis cameras, it reads images as soon as they are available and keeps the last one so that the user code will always be reading the most recent image.
2.) For USB cameras, it serves the images to the dashboard on TCP port 1180.

You have your own image server, and you don't care about the Axis stuff, so you can delete or comment out the Background block and wire up the one you are using that serves two cameras.

The code shown in your attached images looks pretty good, but the compression is basically off. I'll explain more in a sec. With two cameras at 5fps, that is the same as one camera at 10fps with very little compression. From the image, I can't tell what the image size is, so I think the first thing to do is add compression and shrink the image size and test it again.

The server you are using has a T wired to the OpenAndSetMode. This means that the camera itself is doing the compression, and that we have no control on how much to compress. If you set the image size smaller and maybe the fps a to four, I think this will work.

Another approach is to change from camera compressed images to roboRIO compressed images. This involves two edits. The T constant that is wired to the Set Video Mode VI needs to be changed to a false. Next, drop the attached snippet of code somewhere on the edge of your VI. Surround it with the comment block to make it a comment. Notice that one frame of the snippet case structure, the -1 case, looks just like the code you have in your server. It gets the Raw Image Data from the camera and sends it to the dashboard. The other case, the Default one, gets the image and sends that image to the "Flatten Image to String" function telling it to make a JPEG with a compression number that ranges from 0 to 1000.

The default camera server supports both camera compressed and roboRIO compressed, and it uses a compression number of -1 to select camera compressed, and all other numbers mean roboRIO compressed. So if you want to, you can swap out the code in your server with the stuff from the commented snippet. Post the result if you want a review of it.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.png
Views:	53
Size:	37.5 KB
ID:	20134  Click image for larger version

Name:	Image Server Image.png
Views:	66
Size:	14.7 KB
ID:	20135  
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


All times are GMT -5. The time now is 04:21.

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