|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I'm studing image processing and I already wrote algorithms for this task in my computer. These algorithms is in C++ too and they uses images in files. But they depends on access to the images pixels. Is there a way to do this in wpi?
I want to track rectangles in the camera image. I like something like this: AxisCamera &cam = AxisCamera::GetInstance(); MonoImage &image = cam.GetImage()->GetLuminancePlane(); for (int i = 0; i < image.GetWidth(); ++i) { for (int i = 0; i < image.GetWidth(); ++i) {}Color pixel = image.GetPixels(i, j);} |
|
#2
|
|||
|
|||
|
Re: Getting pixels of camera images in C++
The images are transmitted from the camera as a JPEG and you must decode it before you can actually do what you want to do. What you posted will not work. I don't think the Image class even has a "getWidth" or "getHeight". It does however have a pointer to the Image in memory, which is encoded in JPEG. I suggest making your own Image class that takes the WPILib's Image and converts it to a 2d arrays of bytes. Since it is C++, it would be uint_8 (GCC)
Last edited by davidthefat : 12-01-2012 at 20:09. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|