![]() |
Laptop Vision and Converting between WPIBinaryImage and BinaryImage
If anyone is making an effort to do vision on the laptop, let me make your life a little bit easier. Here is the (almost) working code for a vision processing widget in SmartDashboard that I found and have been tinkering with. Right now it's kind of a frankenstein of Greg's code and the stock vision code.
Code:
package edu.wpi.first.smartdashboard.extension.vision;Code:
BinaryImage thresholdImage = finalBin; |
Re: Laptop Vision and Converting between WPIBinaryImage and BinaryImage
Java seems to lack a lot of the more complex image processing algorithms. Furthermore, the NI Vision Assistant can compile its vision processing scripts into C and LabView, but not Java. We initially wanted to do our image processing in Java, but as it stands I think it simply lacks the functionality to do it effectively.
What I'm doing is offloading the image processing to a Labview VI running on our driver station dashboard. This processes the images faster, reduces the load on the cRIO, and enables access to all the higher end functionality Labview offers for image processing. I transmit whatever data I need from the processed images back over TCP to the cRIO, and the Java handles it from there. As much as I hate labview, it seems like one of the best ways to do things so far. EDIT: And while I know this doesn't strictly answer your question of how to do the conversion, it's just my 2 cents on the image processing. |
Re: Laptop Vision and Converting between WPIBinaryImage and BinaryImage
That's the point of doing this conversion. The wpilibj package has almost all the same functions as LabView, prewritten in Java, you just have to call them. Trouble is getting the image to it in the first place. I've found WPIBinaryImage and BinaryImage's respective basic memory units, the trouble is, they're both protected. Is there a way to override the protection (ie make a private variable public in an already compiled jar)?
|
Hopefully I'm wrong, as far as I looked though the Java seemed rather limited.
If you want to mess with the libraries though that's actually a great thing to get into, it opens up a ton of possibilities. Open up My Documents/sunspotfrcsdk/wpilibj and poke around in the /src folder. You can find all the WPI libraries in there, and you can just go find BinaryImage or whichever you're trying to modify, open the .java up in netbeans, and rebuild the libraries. |
Re: Laptop Vision and Converting between WPIBinaryImage and BinaryImage
I spent basically the last twelve hours tinkering with the libraries, and I don't think much will come of it. I don't have any idea how the wrappers for the Labview libraries format their images, because all they store is a Pointer. Rather than continue to be miserable, I think I'll try the Labview route. Are there any good docs on making your own driverstation in Labview?
|
Re: Laptop Vision and Converting between WPIBinaryImage and BinaryImage
Heh, welcome to the club :P
Download and update labview, and when you open it up start a new project and look for a DriverStation 2012 template. To make your actual vision processing script, play around with the NI Vision Assistant software. That'll let you make a whole processing algorithm that it can convert into a Labview VI for you. If you need any help with stages of this please don't hesitate to ask me. I've done the same thing, plus a little, and it's been a long and arduous path though seems to be well worth it so far. I'd be happy to give any information on my setup you need. Basically, I have an image processing subVI in my dashboard. That spits some values back to the dashboard itself, and then over TCP, sends the x,y coordinates of the centers of each detected target to the CRIO. I've made libraries on the CRIO that handle its side of the TCP communication, and dealing with those x,y coordinates which I use for aligning the shooter turret. |
Re: Laptop Vision and Converting between WPIBinaryImage and BinaryImage
Quote:
I've read several posts, including yours, that say Java only has limited image processing routines. So, I'm interested in finding out more detail on how you are using Labview on the driver station dashboard. Are you using the default dashboard provided with the driver station? We're currently using the SmartDashboard. Would your method work with that? If not, I wonder if it's possible to run both the default dashboard and the SmartDashboard at the same time... I have no experience in Labview but I do see that I can create a VI file for Labview straight from the Vision Assistant program. After that I have no clue how to implement it into the dashboard and then send the info back to the Java code... |
| All times are GMT -5. The time now is 10:05. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi