Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
11-13-2014, 12:15 AM
|
#1
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Rep:
|
Camera settings in Linux ...(V4L2 or UVC drivers)
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
Kansai
|
|
|
11-13-2014, 09:10 AM
|
#2
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
Install uvcdynctrl then these commands will help you:
uvcdynctrl -s 'Brightness' 120
uvcdynctrl -s 'Contrast' 35
uvcdynctrl -s 'Saturation' 50
uvcdynctrl -s 'Sharpness' 100
uvcdynctrl -s 'Focus, Auto'
|
|
1 members found this post helpful.
|
11-26-2014, 11:30 PM
|
#3
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
Thank you very much for your helpful reply.
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
|
|
|
11-27-2014, 01:35 AM
|
#4
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
have you tried this way:
uvcdynctrl -s 'Exposure, Auto' 1
?
|
|
|
11-27-2014, 02:35 AM
|
#5
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
Thanks I did try this.
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.
|
|
|
11-27-2014, 03:09 AM
|
#6
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
You can create and use a config file for the settings:
http://manpages.ubuntu.com/manpages/...uvcview.1.html :
-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.
|
|
|
11-28-2014, 12:42 AM
|
#7
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
I am sorry, I dont understand
What for is the config file and what should I include there?
will it help me to correctly see the desired pics?
|
|
|
11-30-2014, 09:16 AM
|
#8
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
I took a closer look at it and it seems that this option does not help. One can only set the luvcview options there I guess.
|
|
|
12-01-2014, 01:19 AM
|
#9
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
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.
I have no idea why this is so... any idea???
|
|
|
12-01-2014, 02:04 AM
|
#10
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
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.
Quote:
system($DIR."setCam.pl &");
system("mplayer tv:///dev/video0 ");
system("fbi $pic");
#setCam
#!/usr/bin/perl
#delay the execution for screen needs some time to start
sleep(4);
# Logitech HD 720p Autofocus
#system("uvcdynctrl -s 'Brightness' 120");
#system("uvcdynctrl -s 'Contrast' 35");
#system("uvcdynctrl -s 'Saturation' 50");
#system("uvcdynctrl -s 'Sharpness' 100");
#system("uvcdynctrl -s 'Focus, Auto' 1");
# Microsoft LiveCam Studio
system("uvcdynctrl -s 'Exposure, Auto' 1");
system("uvcdynctrl -s 'Exposure (Absolute)' 20");
system("uvcdynctrl -s 'Brightness' 150");
#system("uvcdynctrl -s 'Brightness' 250");
system("uvcdynctrl -s 'Contrast' 25");
system("uvcdynctrl -s 'Saturation' 200");
system("uvcdynctrl -s 'Sharpness' 100");
system("uvcdynctrl -s 'Focus, Auto' 1");
|
Maybe that helps? This way we get good photos with a raspi.
Last edited by j-ray; 12-01-2014 at 02:10 AM.
|
|
|
12-02-2014, 07:01 PM
|
#11
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
quick question.
When I do
>uvcdynctrl -g 'Exposure, Auto'
I get the value of manual or automatic.
However one colleague using ubuntu when he does the same thing gets nothing.
Wonder why this is so?
|
|
|
12-03-2014, 01:46 AM
|
#12
|
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591
Rep: 
|
Same camera model?
|
|
|
03-11-2015, 07:33 PM
|
#13
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
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.
Thanks for all the help
|
|
|
All times are GMT -5. The time now is 07:37 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|