|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Tracking in JAVA?
Ive read several posts regarding the white papers, which I've read, and other math based solutions to tracking which I understand. How am I supposed to actually measure the targets in my code? I found all the stuff regarding the images themselves but how do I analyze the images in my code?
|
|
#2
|
||||
|
||||
|
Re: Tracking in JAVA?
What point are you at? Do you have an image from the camera? If you are more specific, we can tell you what the next step is
![]() |
|
#3
|
||||
|
||||
|
Re: Tracking in JAVA?
So I've been messing around with it for a bit and so far all I managed to get is this:
Code:
try {
ColorImage img = camera.getImage();
// Do the threshold
BinaryImage bImg = img.thresholdHSL(0, 255, 0, 20, 239, 255);
//Do convex hull???
for(int i = 0; i < bImg.getNumberParticles(); i++)
{
ParticleAnalysisReport report = bImg.getParticleAnalysisReport(i);
// Identify the vision targets in here using the reports
}
// Work with the vision targets
} catch (AxisCameraException ex) {
ex.printStackTrace();
} catch (NIVisionException ex) {
ex.printStackTrace();
}
Code:
//IMAQ_FUNC int IMAQ_STDCALL imaqConvexHull(Image* dest, Image* source, int connectivity8); This is the first year our team is attempting camera tracking, by the way. http://www.wbrobotics.com/javadoc/ed...e-summary.html |
|
#4
|
|||
|
|||
|
Re: Tracking in JAVA?
Yea im stuck too, this is my first year using vision tracking
|
|
#5
|
||||
|
||||
|
Re: Tracking in JAVA?
Quote:
Where are you stuck? |
|
#6
|
|||
|
|||
|
Re: Tracking in JAVA?
Quote:
Code:
ColorImage image = AxisCamera.getInstance().getImage(); |
|
#7
|
||||
|
||||
|
Re: Tracking in JAVA?
Quote:
So from there, you have an image object. I would recommend printing out the height and width of the image, to make sure your camera is hooked up properly. From there, the traditional route is to threshold the image to get a binary image which should ideally contain only the rectangle. From there, WPILib has a rectangle detection function, which should work for basic stuff. From there, you get the height and width, and can do a bunch of trigonometry to figure out how far away it is. I would start by figuring out the thresholding functions; play around with them and see what they do. If you have any questions, please ask! |
|
#8
|
|||
|
|||
|
Re: Tracking in JAVA?
Quote:
and where is the rectangle detector i could not find it. Sorry im a real noob on java i havent had much teaching. |
|
#9
|
||||
|
||||
|
Re: Tracking in JAVA?
I have no experience with it, but the Labview code lets you play with threshold values as you operate the camera. You should check the Labview subforum for this; there are some people from NI who know much much more about it than me.
I'm sorry, but the "detect rectangles" code is only in C++ and labview... I'm relatively sure that if sample code is posted like it is most years, it will contain rectangle detection code (that is, if sample code is posted). Once you find a nice threshold, you should look at the particle reports, since those are what you will be analyzing. You can get the bounding rectangle of a piece of the image, and know the expected area filled (since you know the width of the tape), and can compare that to the particle filled area...but i would concentrate on the thresholding for now ![]() Everyone is a noob sometime, that's what these forums (and FIRST) are for ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|