|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Tower Tracker 1.0
Hey guys!
How do you calibrate the camera, exactly... I have opened up GRIP and got the RGB values of a setup in which the goal is clear and then took those values and edited the Lower and Upper bounds respectively but have been getting 0 contours.. Thanks! |
|
#2
|
||||
|
||||
|
Re: Tower Tracker 1.0
Do you have a link to your code? Also you might want to check that the lower and upper bounds are in BGR order instead of RGB. It took me a while to figure that out.
|
|
#3
|
||||
|
||||
|
Re: Tower Tracker 1.0
I am using an untouched version of TowerTracker and I found RGB values on GRIP and I put them as the Upper and Lower Bounds in BGR order and I still am detecting nothing. Any suggestions? Thanks!
|
|
#4
|
||||
|
||||
|
Re: Tower Tracker 1.0
Can you use imshow to display a window of what your original, resize, and threshold Mat's look like? That might help.
|
|
#5
|
||||
|
||||
|
Re: Tower Tracker 1.0
I am not sure how to do so. I am running the Java code provided. I remember your team discussing this on another thread. How exactly do you guys calibrate because that seems to be the problem.
Thanks! |
|
#6
|
||||
|
||||
|
Re: Tower Tracker 1.0
To calibrate the camera, what we did was save the first image it grabbed and then downloaded it onto our pc. Then we brought it into GRIP and found the right RGB values. Then we just plugged it into lower and upper bounds arguments. It worked for us. We did have an issue where we had a really bright image right when the camera started. My best guess is because the camera lens is still adjusting its white balance or something like that. But when just ran the code again after the camera was on for a second. This wasn't a problem in competition because your robot is on a while before the match starts.
|
|
#7
|
||||
|
||||
|
Re: Tower Tracker 1.0
Elaborate on the finding the perfect RGB values. Would you find these to be good?
|
|
#8
|
||||
|
||||
|
Re: Tower Tracker 1.0
I would actually recommend doing your calibration in the HSB/HSV color space, as it separates color(H) from brightness(B/V) which means you can get a more robust calibration that will working in many different lighting environments (as the color your LEDs output shouldn't change) provided you turn your camera's exposure down.
|
|
#9
|
||||
|
||||
|
Re: Tower Tracker 1.0
and how to modify the code to use HSV instead of RGB?
|
|
#10
|
||||
|
||||
|
Re: Tower Tracker 1.0
Quote:
Also, those values seem fine to me. I think i see the issue. Tower Tracker checks if the goal bounding rectangle is wider than it is tall. So when viewing from sharp angles like that is not going to give you a selected contour. Do you have a test image where the goal is straight on? If not, you can just get rid of this segment of code: Code:
float aspect = (float)rec.width/(float)rec.height;
if(aspect < 1.0)
iterator.remove();
|
|
#11
|
||||
|
||||
|
Re: Tower Tracker 1.0
Oh! Thanks so much! We were hoping to have this running by this Saturday for our competition!
![]() |
|
#12
|
||||
|
||||
|
Re: Tower Tracker 1.0
So it works? If so, good luck at competition. Any questions, PM me or post here.
|
|
#13
|
||||
|
||||
|
Re: Tower Tracker 1.0
Sorry for double post but just making sure you see this...
I would also check for solidity of the target. This makes sure you don't get stray objects even if it passes all other checks. Here is c++ code, very similar to java. Code:
float area = contourArea(contours[i]);
float hull_area = contourArea(hull);
float solidity = (float)area / hull_area;
if (aspect > 1 && rect.area() > 100 && (solidity >= .04 && solidity <= .4)) {
selected.push_back(contours[i]);
}
|
|
#14
|
|||
|
|||
|
Re: Tower Tracker 1.0
The aspect ratio part of the code helps filter out things that the hsv filter cannot. We know the target is always wider then it is tall therefor it's aspect ratio will always be greater then 1 and if it's not don't detect it as a possible target. There are other things you can do to help but my team has found its good enough. You always know it's going to be atleast a certain pixel range because you can only shoot from a certain part.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|