|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Tweaked SmartDashboard for Image Overlays
We've been playing around with the SmartDashboard code to add support for image overlays to help debug vision code. It's somewhat basic at the moment, and we're planning on improving it, but what's there is already a huge help. Essentially, it allows you to send a list of targets back over the SmartDashboard connection that are rendered onto the camera image.
Right now it just draws black bounding boxes around the targets sent back, but we're planning on allowing you to specify colors and shapes to help differentiate the targets. It's also a little bit hacky and likes to display a couple of extra fields on the dashboard, but the "__overlay" fields can be shoved into a corner without causing any problems. I'm a lazy programmer, so the modifications don't have a C++ counterpart, and I haven't sent a patch to the SmartDashboard guys, although that's something I'd like to do in the near future. Anyway, if anyone wants to give it a go, just do a subversion checkout: Code:
https://lhrobotics.svn.sourceforge.net/svnroot/lhrobotics/trunk/sdbmod/ As for the robot, you'll need to grab this file (also svn, but just grabbing it works fine too -- it's just one file). In the source folder for your robot code, make the folder structure edu -> wpi -> first -> wpilibj, and place the ModdedSmartDashboard.java there. The only major change needed to robot code is to make sure you use the "ModdedSmartDashboard" class in place of "SmartDashboard" - using both (even in different parts of your code) will probably cause problems. Then, wherever you can get access to a ParticleAnalysisReport or something with target x/y/width/height, add: Code:
ModdedSmartDashboard.startOverlay(); // do this before sending new targets to clear any old target overlays ParticleAnalysisReport r; // get this from somewhere or use your own data ModdedSmartDashboard.overlay(r.center_mass_x, r.center_mass_y, r.boundingRectWidth, r.boundingRectHeight); Anyway, hopefully somebody out there can find this useful! |
|
#2
|
||||
|
||||
|
Re: Tweaked SmartDashboard for Image Overlays
This sounds really useful. I'm surprised a lot more folks are not hopping on this bandwagon. We are pulling our hair out trying to figure out why the tracking algorithm (http://firstforge.wpi.edu/sf/go/doc1209) is producing so many particles. It would be really nice to be able to see the particle bounding boxes overlaid on top of the image (or better yet the processed, binary image).
We got spoiled working with RoboRealm software (project outside of FIRST). It does this for you automatically. Anyway, we here at Team 3863 fully support your efforts. Thank you and let us know about any updates. |
|
#3
|
|||
|
|||
|
Re: Tweaked SmartDashboard for Image Overlays
Glad to hear you find this useful!
We've pushed some new updates to clean up the dashboard itself (better theme, standardized field labels, etc) that also allows colored overlays. It's great for coloring particles that meet certain parameters (size, quality, position, etc) and the like. I'll be updating to original post with the new info soon. Edit: or not, guess you can't edit opening posts or something to that extent... Anyway, there's one new file added with predefined color constants: here ModdedSmartDashboard.java has also been updated (same link as before). New changes include...
The dashboard has also been tweaked, you can just "svn update" to get the updates. If there's any, well, weirdness... we may have gotten a bit bored while waiting around, so there's a chance some unexpected surprises may pop up (hopefully not though). Again, hopefully this can help out some other teams! Last edited by timothyb89 : 02-03-2011 at 16:32. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|