[SOLVED] Camera settings in Linux ...(V4L2 or UVC drivers)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thank you everybody who has helped me so far. I appreciate it very much.
This time I would like to ask about connecting a camera to a linux system. I am a little confused about what exactly to ask so please bear with me
The situation
I have a USB camera that I connect to an arm microcontroller running linux (a variant of uCLinux)
since the manufacturer didnt provide any driver, but the camera is UVC compliant, the camera is recognized by the linux system.
Moreover, using V4L2, I can build a simple program that grabs some camera shots and save them as files
so far so good.
The question
Is there a way I can set up, or modify the settings of the camera (white balance, etc) with the tools I have (mentioned above) or others. In other words, I am not going to get a special driver made for the camera from the manufacturer.
Thank you very much for your comments and any help
I have installed uvcdynctrl and I have also installed cheese.
(well, I have cheese and guvcview are all buggy in my system, I dont know why but that is another issue)
the thing is, even when I change the exposure settings with uvcdynctrl , this is not reflected in the image I take.
For example if I put
Code:
uvcdynctrl -s Exposure,\ Auto 1
uvcdynctrl -s Exposure\ \(Absolute\) 100
the image is not dark. and if I set
Code:
uvcdynctrl -s Exposure\ \(Absolute\) 4800
the image is not all bright. In fact it doesnt change.
What am I doing wrong?
Kansai
P.S> I tried in guvcview to change the settings and it worked for a while. I could get some bright and dark images, but cheese remains unchanged and guvcview remains unchanged sometimes
P>S2 I also wrote a program to take photos and change exposure in V4l2 and the same, the pictures dont change
Let me clarify. I can change the exposure settings (with uvcdynctrl and my own program) but these changes aren't reflected in the photos I take (with cheese or my program)
Interesting thing though. I tried using luvcview. When I run it, the image I see does not reflect the changes either, however when I change the exposure value with luvcview I immediately can see an overexposed image or an underexpose one
however, if I close luvcview and start it again, it agains regain an auto regulated exposure, and only by changing it with the program can I see the difference
strange....
any help appreciated
Last edited by KansaiRobot; 11-27-2014 at 02:42 AM.
-r Read and set control settings from the luvcview.cfg file in the
current directory. Such a configuration file can be created by
using the F1 key in the interface.
at the same time as using luvcview and uvcdynctrl I am also doing my own program. And I found something interesting.
I am not going to write the whole program here but algorithmically it used to go like this
Code:
open device
init device
set settings <== here I set the exposure and stuff
start capturing
take several photos
stop capturing
close device
Well, id didnt work, the settings were not reflected on the image.
I changed the code to include settings inside the "take several photos" function
So now after each photo I change the settings
and it worked! I can see the photos reflecting the new settings
ONLY ONE PROBLEM! For some reason the photos don't reflect the settings immediately after changing them. It takes three photos to waste and the fourth photo after changing the settings is the one that reflects the settings correctly.
A while ago I have written a perl script that runs a camera with mplayer then takes a photo with fbi and saves it somewhere. Before opening the screen it calls a 2nd script called "setCam.pl" that uses uvcdynctrl to reset the camera.
Well just to close this thread and write a solution in case someone else have a similar problem...
I finally solved the issue. The thing is that I had to change the Exposure and the Gain settings after I started the photo capturing not before (all other settings are to be set before). In addition Gain can only be set when Exposure is set to manual.
I also had to throw away the first three pics cause they don't reflect a stabilized camera.
With these changes, I built a program that could set parameters and take pics successfully.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.