Mr. Lim
16-01-2014, 06:55
We are having difficulty trying to access the raw image data inside of a ColorImage.
Ideally, we'd like to get an array of ints such as:
int[][] frame = new int[320][240];
that holds RGB values of each pixel in each element.
We know that a ColorImage has a Pointer to the image data, and that Pointers have a getInts method.
We've tried getInts to populate our array, but we keep getting OutOfBoundsExceptions. I have a few questions about the parameters for this method:
getInts
public void getInts(long offset,
int[] ints,
int low,
int number)
Should the offset be 0? I'm assuming the image's Pointer is pointing to the beginning of the image data.
Is the image data even stored as ints? Or should I be getting some other type instead? bytes? How exactly is image data stored in a ColorImage obtained from an Axis Camera? My assumption is a sequence of ints, each representing an RGB value for each pixel. I could be very wrong. Is this image still compressed at this stage? Is there a method call to decode it into some kind of bitmap close to what I've described above?
When I try and getSize of the image's Pointer, it returns 0? Is this Pointer improperly constructed? No matter what I try and get (bytes, ints, single values, or arrays) using this Pointer, I get an OutOfBoundsException. If I construct a new Pointer at the same address, with some arbitrary size, I can get values, but it doesn't look like any kind of RGB data I recognize.
How can we get access to raw image data?
Ideally, we'd like to get an array of ints such as:
int[][] frame = new int[320][240];
that holds RGB values of each pixel in each element.
We know that a ColorImage has a Pointer to the image data, and that Pointers have a getInts method.
We've tried getInts to populate our array, but we keep getting OutOfBoundsExceptions. I have a few questions about the parameters for this method:
getInts
public void getInts(long offset,
int[] ints,
int low,
int number)
Should the offset be 0? I'm assuming the image's Pointer is pointing to the beginning of the image data.
Is the image data even stored as ints? Or should I be getting some other type instead? bytes? How exactly is image data stored in a ColorImage obtained from an Axis Camera? My assumption is a sequence of ints, each representing an RGB value for each pixel. I could be very wrong. Is this image still compressed at this stage? Is there a method call to decode it into some kind of bitmap close to what I've described above?
When I try and getSize of the image's Pointer, it returns 0? Is this Pointer improperly constructed? No matter what I try and get (bytes, ints, single values, or arrays) using this Pointer, I get an OutOfBoundsException. If I construct a new Pointer at the same address, with some arbitrary size, I can get values, but it doesn't look like any kind of RGB data I recognize.
How can we get access to raw image data?