![]() |
Raw Camera Data
I've been dabbling in the camera inputs, as our team's mechanism is finally starting to come together, and I've noticed the color tracking that either NI or WPI set up (Not sure who the code is coming from) is very crudely written. Does anyone know of a way to get the raw data from the camera (preferably like a two-dimensional array of ints with rgb data)? I have written code to filter out blobs of known colors (And it works with pretty much any color, not just the bright pinks and greens for this), though I have yet to find a way to define their bounds without just averaging the position of each pixel of a given color. All I need is that array.
Thanks for your help |
Re: Raw Camera Data
If you look into the nivision.h file, you should find something to extract pixel integers from the image file. Sorry I can't be more helpful, but I don't have the C tools installed on this computer. But it exists in LV, so I know it exists in C. If you are looking to do the comparisons in RGB, I'd encourage you to compare it against the color tracking in the WPI or nivision file. The nivision stuff is going to be hard to beat for standard algorithms like color thresholds. Second, I think you'll find that the algorithm will be far more resilient using HSL math.
Greg McKaskle |
Re: Raw Camera Data
I'm using an algorithm I designed from scratch that doesn't use thresholds. And my algorithm uses an HSV derived colorspace, slightly diffent than HSL but I believe it to be more effective. We'll see how it works though, and thanks for the heads up.
|
Re: Raw Camera Data
Sounds good so far. I'm curious to hear how it goes, and more about details.
Greg McKaskle |
Re: Raw Camera Data
Quote:
void* imaqImageToArray(const Image* image, Rect rect, int* columns, int* rows); although it doesn't show hsv take a look in C:\WindRiver\docs\extensions\NIVisionCVI.chm it describes all the functions as well as the data structures etc. |
Re: Raw Camera Data
Thanks, I'll take a look at it at our team's meeting today, and that it doesn't show HSV is a good thing. Calculating HSV from RGB is a tad expensive, notably the hue component, so we are going to avoid that until we need it.
Code:
typedef struct { |
Re: Raw Camera Data
Quote:
|
Re: Raw Camera Data
I'd also like to get a bit more help on how to go about getting RGB and coordinates for pixels...I've worked with OpenCV before and my approach to programming the bot is influenced by that...My experience with object oriented programming is limited and the User Guide is helpful, but exhausting. I'd find it easier to get some raw data and make my own functions.
|
Re: Raw Camera Data
In case you want to use it, the NI libraries already include HSL and HSV conversions. The color threshold in the examples is already being done in HSL.
And if you want the raw stuff imaqImageToArray() will get it for you. Greg McKaskle |
| All times are GMT -5. The time now is 02:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi