![]() |
Getting pixels of camera images in C++
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);} |
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)
|
| All times are GMT -5. The time now is 05:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi