Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Speed of the camera (http://www.chiefdelphi.com/forums/showthread.php?t=72876)

Alan Anderson 20-02-2009 16:25

Re: Speed of the camera
 
Quote:

Originally Posted by TheDominis (Post 825604)
I've uploaded the C++ and C# versions of Team 2152's image processing software. The C++ code compiles in our magical project, but has not been tested.

Wait, what? Never mind the image processing -- how are you using C# on a cRIO?

ErichKeane 20-02-2009 16:26

Re: Speed of the camera
 
Hes' not using C#, he wrote the same algorithm in C# so he could run it in Windows.

The code is pretty clean, and I can see why it is faster than the abomination that comes with the Two Color Tracking code.

TheDominis 20-02-2009 16:27

Re: Speed of the camera
 
Quote:

Originally Posted by Alan Anderson (Post 825617)
Wait, what? Never mind the image processing -- how are you using C# on a cRIO?

We're not using C# on the cRIO. We wrote it in C# using functions that did the same thing on the cRIO and I ported it to C++.

-TheDominis

Alan Anderson 20-02-2009 16:33

Re: Speed of the camera
 
Quote:

Originally Posted by TheDominis (Post 825620)
We're not using C# on the cRIO. We wrote it in C# using functions that did the same thing on the cRIO and I ported it to C++.

Quote:

Originally Posted by TheDominis (Post 825604)
The C++ code compiles in our magical project, but has not been tested.

I'm confused. If you didn't test it, how did you measure the astounding image processing rate you told us about? I suppose you might have been talking about how quickly you could do it on a Windows PC, but that's not what the poll was asking.

TheDominis 20-02-2009 16:38

Re: Speed of the camera
 
Quote:

Originally Posted by Alan Anderson (Post 825621)
I'm confused. If you didn't test it, how did you measure the astounding image processing rate you told us about? I suppose you might have been talking about how quickly you could do it on a Windows PC, but that's not what the poll was asking.

No. It was the with code on the cRIO. We couldn't do the extensive testing we did as quickly as we did on Windows on the cRIO. The code we tested used a quick (and buggy) implementation of the current and more robust implementation.

-TheDominis

Tom Bottiglieri 20-02-2009 16:52

Re: Speed of the camera
 
Quote:

Originally Posted by TheDominis (Post 825627)
No. It was the with code on the cRIO. We couldn't do the extensive testing we did as quickly as we did on Windows on the cRIO. The code we tested used a quick (and buggy) implementation of the current and more robust implementation.

-TheDominis

I will test out the code as soon as I can on our practice robot to verify your results. Any special usage instructions?

TheDominis 20-02-2009 16:59

Re: Speed of the camera
 
I doubt you have math1.cpp so I would comment out lines 8, 166 - 169, Add at line 424

Code:

//line 8 - #include "math1.cpp"
double CalculateDistanceFromCamera(Report report)
{
        return math::Rat::PixelsToDistance(report.height, report.width);
}

Code:

CleanValues(); //at line 424
Also I have yet to test this on the cRIO -- waiting for a robot. I expect that this won't get the same results as the beta algorithm did (I hope it does).

-TheDominis

Tom Bottiglieri 20-02-2009 17:06

Re: Speed of the camera
 
Quote:

Originally Posted by TheDominis (Post 825638)
I doubt you have math1.cpp so I would comment out lines 8, 166 - 169,

Code:

                //line 8 - #include "math1.cpp"
                double CalculateDistanceFromCamera(Report report)
                {
                        return math::Rat::PixelsToDistance(report.height, report.width);
                }

Also I have yet to test this on the cRIO -- waiting for a robot. I expect that this won't get the same results as the beta algorithm did (I hope it does).

-TheDominis

What is going on in the PixelsToDistance function?

TheDominis 20-02-2009 17:19

Re: Speed of the camera
 
Quote:

Originally Posted by Tom Bottiglieri (Post 825639)
What is going on in the PixelsToDistance function?

The name says it all. We have this function that calculates pixels to distance as another reference point.

-TheDominis

TheDominis 20-02-2009 19:01

Re: Speed of the camera
 
1 Attachment(s)
I come with gifts of code that actually attempts to find the target! I did a sloppy job with the transition from C# to C++ :*( . I want a robot to test on...

-TheDominis

Greg McKaskle 20-02-2009 21:19

Re: Speed of the camera
 
Looking through the code I see a few things that jump out at me. On the good side, you have some expressions that ID the two target colors in RGB space. This will probably be faster than HSL comparisons, but be sure to test if it will be accurate. Be sure to test it against a full color spectrum from fully saturated, pastels, dark colors, etc. It will also be harder to tune if/when the lighting color changes, but otherwise it is a good approach.

On the worrisome side, it looks like you are starting up the camera with compression setting of 0. In my testing, that always resulted in slower framerate and skipped images. If you see issues, move that up to 20% or so, just watch the numbers near 0 and 100.

Greg McKaskle

TheDominis 20-02-2009 21:40

Re: Speed of the camera
 
Quote:

Originally Posted by Greg McKaskle (Post 825754)
Looking through the code I see a few things that jump out at me. On the good side, you have some expressions that ID the two target colors in RGB space. This will probably be faster than HSL comparisons, but be sure to test if it will be accurate. Be sure to test it against a full color spectrum from fully saturated, pastels, dark colors, etc. It will also be harder to tune if/when the lighting color changes, but otherwise it is a good approach.

On the worrisome side, it looks like you are starting up the camera with compression setting of 0. In my testing, that always resulted in slower framerate and skipped images. If you see issues, move that up to 20% or so, just watch the numbers near 0 and 100.

Greg McKaskle

We've tested the comparisons for green/pink extensively. Also we tested the comparisons with lights off (a majority) and with lights on and flash lights shining on the target in different areas.

We haven't actually tested the camera FPS since our hardware team is somewhat on the slow side in comparison to the software team. This is also why I wrote my algorithms in C#. I'll make sure to keep that in mind.

-TheDominis


All times are GMT -5. The time now is 21:52.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi