View Single Post
  #2   Spotlight this post!  
Unread 23-09-2012, 22:42
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Extract Raw Pixel Data

Quote:
Originally Posted by SoyStuff View Post
I know that there are plenty of pre-made image analysis functions at my disposal, but for my own amusement, I would like access to the raw pixel data in images from the Vision camera. That is to say, I would like to be able to specify a location in an image and figure out what color it is (RGB). If there is a function that enables this, that would be great. If, however, the function is high level and carries a lot of overhead, is there a more efficient way to get this data?
I assume you're meaning when using the NI Vision libraries on the cRIO. However, which language are you using?

For LabVIEW, see the example at C:\Program Files\National Instruments\LabVIEW 2011\examples\Vision\2. Functions\Image Management\ImageToArray Example.vi (translate the path if you installed LabVIEW in a different location). The Java interface to NI Vision doesn't seem to include this function. For C++, there appears to be information in this thread on NI.com.

When you call this function a copy of pixel memory will be made (source, see the previous linked thread for an explanation why). This probably isn't too bad as long as you only need to do it once or twice per frame, but it's rather likely that you could get better efficiency by using the built-in operations.

A rather radical approach would be to completely roll your own vision solution and use a third-party library to decode the JPEG returned by the camera. Finding a preexisting implementation of such a library should be pretty easy in C++, but would be harder for Java (because the Squawk VM doesn't contain the full desktop Java API) and even harder for LabVIEW (AFAIK most people just use the NI Vision libraries). Also consider that code that you either find or write probably won't be as optimized for the cRIO as the functions provided by NI.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote