View Full Version : Saving Photo to Computer from Camera
We are trying to save a photograph from the camera while it is connected to the robot. We want this image so that we can add image masks and ultimately detect the Retro-Reflective tape.
Here is 2 different ways we have tried coding it but neither work.
https://3487422552756459162-a-1802744773732722657-s-sites.googlegroups.com/site/alhsshorebots/programming/savingphototocomputerfromcamera/Saving%20Photo.png?attachauth=ANoY7cqn8CulK74N92Sb BRwASsrErYnqNdgrRoNMmBVBQU3Iwt9OUJQTEMJOAfMzurvKe6 o0ufBVhVYoZxemWWvIQH6t8x2KmTC4Wp02a-89VPBZP53r_WCaKmL27WaPLvlDhhn1Bszc-lXSwzQICe-h5zdmFV4wrwfsmDRwNUXOEWmWpgfc_zS4Z0pFuKiSTjy5gMEUv avm2QJCEKou3EkxPHvDJTivBAB1swfFMJwt9yRXVVRIyavH_gi woLvGhik8NiNNvZ7xw5gYJLfvJb_iV2bQutnARw%3D%3D&attredirects=0
https://3487422552756459162-a-1802744773732722657-s-sites.googlegroups.com/site/alhsshorebots/programming/savingphototocomputerfromcamera/Saving%20Photo2.png?attachauth=ANoY7coQ8HkLnodBnB4 Ivyn2uvoCuYy2LNXa4oN1VA2co00jtBa9RFHBKQtLHLQOreiQE rIDCatKCKTY6kvfZAQ6WTm66986bpDgSadmkM_QT-X9LBDf3Dzo7v9Q9d6wkd_AEOUauoJVb4zXFiN_rYR-_2bidTwpX4DCLIr0wcAWW6u1fRYnof8GHVORiDRFb8iv1MC45f hOh2ZHoYIPxQTV0SBXJkPciHWQGGQi9nZFJNoO-mLZ8VqHFE0vJXQpgjsLU9pxqTVFVN2_0PKBPwKw1TSLWXjv-w%3D%3D&attredirects=0
I got out dashbord to save images, and video! I'll upload the later code so you guys can take things form it. Here is a picture for now
OK here it is! There is a Library for USB cameras you can get. Its is really good for testing camera code, that is what i used to make this.
When I run it this error comes up:
IMAQ AVI Write Frame loaded with errors on the target and was closed.ct function name.
Deployment complete with errors.
And the picture doesn't save
Sent from my SGH-i917 using Board Express
Tommy F.
06-02-2012, 16:19
Can't you save an image while the camera footage is on the driver station by right clicking over the feed?
AndyB871
07-02-2012, 09:34
I'm making some basic assumptions here:
1) You're using the Axis camera
2) you're using the 8 port cRIO
3) You want to get the image from the axis to the PC to do your processing.
When we first started we were having major issues with getting images from the camera, through the cRIO to the PC. It turned out that in vision_processing.vi there is a little brick that kicks off "Mjpeg loop". That VI is responsible for retrieving and queuing images from the camera locally on the cRIO. That's all well and good, but since the cRIO is in between the camera and the PC you need to actively transmit the camera data to the PC. In the WPI library somewhere ( I'm at work, and i cant remember the path in the little icon book thingie) There's a loop called "Send2PC" You need to kick that loop off in parallel with Mjpeg loop in order to have the robot send the images to the PC.
Now, If any of my assumptions are wrong, then I feel rather silly for explaining so much lol. I Hope this is helpful.
-Andy
Greg McKaskle
07-02-2012, 09:44
Andy, your explanation of how to send to PC is spot on assuming the camera is connected to the 2nd port of the 8 slot cRIO. The other way of doing this, which will improve performance of the vision and lower CPU usage on the cRIO is to connect the camera to the drink switch. At that point, the IPs change, no Send2PC is needed, and the dashboard and other computer programs ( even Vision Assistant and the web browser) can see the camera.
Greg McKaskle
AndyB871
07-02-2012, 09:51
Greg,
Im guessing Drink -> dlink. :) And yeah, I kind of figured that that was the better way to do it. I just kept it that way to make a nice challenge for my programming team. In the end, though, like you said, we'll probably end up with the camera connected to the dlink.
As a side note, we only measured ~3-5% drop in CPU usage on the cRIO when we turned off the camera acquisition stuff, and with a short delay to stop the teleop loop from eating all of the free CPU time our CPU hangs around 80-90% which leaves plenty of time for other stuff to happen (except onboard video processing which we discovered the hard way via a psychotic runaway robot. Yeah..... safety....)
Joe Ross
07-02-2012, 12:18
The dashboard saves a picture every second, and saves 60 seconds worth of pictures automatically.
It plays back at 2x speed because you added a constant of 15 frames a second of Playback speed, and the default is 30.
Greg McKaskle
18-03-2012, 10:48
By the way, I recently used the AVI VIs to save off a movie related to robotics, and it is pretty straightforward. One oddity is that the file must have an avi extension and it only works for 8 bit and RGB image types. If your DS computer isn't fully loaded, you may find it intersting to save off videos of the camera with ringlight. I'd be interested in different ones to learn how much the shooter motors vibrate the camera, how close other field elements appear, etc. I have some photos I took of WPI that I'll post showing how lights and other elements look a bit like the goals.
The AVI api can also be used to playback the video through your processing code to learn when it missed a target or saw a false target. Again, if you aren't going to do this with your robot movies, I'd like to.
Greg McKaskle
Steve Warner
18-03-2012, 12:15
Joe, this weekend we looked on the classmate for the images saved by the dashboard but could not find them. Do you know where they are stored? Are they saved by the default dashboard?
Joe, this weekend we looked on the classmate for the images saved by the dashboard but could not find them. Do you know where they are stored? Are they saved by the default dashboard?
They are saved in "..\My Documents\LabVIEW Data"
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.