-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libsolocam.so supports only 720p grayscale #255
Comments
The buffer returned from the library is actually a YUV420 image. The python code only uses the Y plane to get a grayscale image, but you could modify it to use the color data in the U and V planes as well. Once you The |
Thanks for the input @kevinmehall . That should work for me. |
@kevinmehall The source for libsolocam.so should be in this repo, otherwise it's going to get lost in this issue |
Hi @kevinmehall - thanks for your work on the library. I'm keen to get colour images as well, so would you be able to share some instructions for building it too? |
The image from libsolocam.so is actually a color image in YUV420 format, despite the function name. This is what comes off the HDMI port, and is the only mode you'll get (at least with the GoPro HDMI input I've tested). It just happens that a YUV420 image begins with the Y plane, which is a grayscale version of the image, followed by color data in the U and V planes. The original application was some computer vision code that needed grayscale, so this was convenient because it could just ignore the color planes when it converts the Y plane to a numpy array. You can't change the pixel format at the V4L2 level -- you have to convert it yourself or use a library like gstreamer to do it for you. Compiling C code for Solo is kind of a big missing piece in this dev guide, in part because the toolchain that 3DR developers have handy comes from the Yocto-based tree we use to build the entire SoloLink system internally. Let me try and see if there's an easy solution for this case, though... |
This builds it on my Ubuntu 15.10 system, but I haven't yet tested the resulting binary on a Solo to make sure it links properly:
|
+1 |
Thanks @kevinmehall I will try the build. In the meantime I tried using the YUV420 buffer but had a hard time getting the color frame in python. Ended up using the following for color frame: This worked but it is pretty slow. So maybe I should have another look at the buffer returned from libsolocam.so and see if I can compose the color frame from it and then if that does not work modify and rebuild the lib. |
Anyone had any luck compiling |
I could compile solocam but I still can't run SoloCamera example because of |
Cool, how did you compile it? Did you compile it on the solo itself? |
I managed to get it to compile on the solo, next step: try it out. First install GCC
Then build!
|
I've been able to modify, compile and use new |
@alexblack Very cool. If you're so inclined you might want to create and point to instructions on how to do this ... perhaps in the wiki. |
hey @hamishwillee I posted instructions just above! |
@alexblack I am blind. Thank you! |
Anyone managed to capture video at 1920x1080? See #313 |
I think I see how to get color images! I haven't tried it. But this line: https://github.com/3drobotics/solodevguide/blob/master/examples/opencv/SoloCamera.py#L67
Is what converts the color YUV420 image into grayscale. In YUV420, the Y channel comes before the others, and its luminance. That line above creates an array backed by the data starting at the start of the buffer, up to and including the first w*h values, which is all the Y pixels. If you instead made the array include the U and V channels, then you'd have color, and you could ask opencv to convert it to something sensible perhaps with:
(Alternatively, you could modify and recompile |
This is interesting. Will give it a try. I have not used the drone for a while and will be getting back into it. |
I tried it and it works perfectly:
In solo Onboard it is really slow (less than 2 frames per second), i will try something quicker maybe reducing resolution. |
Nice work! I'd suggest compiling a new |
can anyone share their compiled libsolocam for rgb? |
@alexblack @David-Proconsi |
@tasarmiento no, I wasn't able to change the FPS or resolution :( |
Looks like this lib supports only one video format. Any plan of expanding the capability. I use it with face detection and would like to see the fps figures for other video formats as well, including color.
The text was updated successfully, but these errors were encountered: