Patch Title
Brightness, Contrast, Saturation, Hue
Introduction
This patch allows motion to set the brightness, contrast, saturation and hue for a video source.
Description of Patch
The patch adds four new config file options:
Option |
Description |
Detailed Comment |
brightness |
The brightness level for the video device. Valid range:0 to 255 Default:0 (Disabled) |
If this setting is used in conjunction with the auto_brightness feature then this setting is just an initial setting and then the auto_brightness feature takes over. |
contrast |
The contrast level for the video device. Valid range: 0 to 255 Default = 0 (Disabled) |
|
saturation |
The saturation level for the video device. Valid range: 0 to 255 Default = 0 (Disabled) |
|
hue |
The hue level for the video device. Valid range: 0 to 255 Default = 0 (Disabled) |
|
Installation of Patch
$ cd motion-3.1.17
$ patch -p1 < picture_controls.patch
Note: The status of this patch is
PatchInProgress because it does not work with FreeBSD. It would probably be fairly simple to port it but
video.c
looks quite different from
video_freebsd.c
and I have no way of testing it on FreeBSD.
i'll test it on FreeBSD , not sure it will be so easy to make it work with bktr though.
--
AngelCarpintero - 07 Oct 2004
Great patch. Many new options
But in contrast to most options these everyone can understand so that does not worry me too much
So my oppinion about the patch and its change to be part of mainline Motion is
Does it break FreeBSD?
Even if the feature cannot be implemented on bktr - it is still worth considering on the Linux side.
Things we need to test (also a reminder to myself).
- Does the controls work when changed with motion-control?
- Does a capture card with PAL fail when setting hue?
- Does USB cams fail or ignore or actually work with any of the settings? Any non-logical behavour should at least be documented in the guide.
--
KennethLavrsen - 08 Oct 2004
Using Fedora Core 2 - kernel 2.6.8-1.521 using everything but MySql/Postgres
Everything working fine. This patch will be a blessing as
V4L2 does not have the setv4l that let me set hue. However... when applying the patch...
[root@pcp09382552pcs motion-3.1.16]# patch -pl < picture_controls.patch
patch:
** strip count l is not a number
BTW
Your Installation of the patch shows a hyphen and the patch is an underscore.
Any insight into the error?
Thanks,
Jim
-- JimFager - 09 Oct 2004
Jim,
The command is patch -p1 not patch -pl and thanks for spotting the hyphen/underscore mix-up I have corrected it above.
-- MikeLees - 09 Oct 2004
Thanks Mike. Old eyes, I guess.
Patch installed OK with the proper command.
[root@pcp09382552pcs motion-3.1.16]# patch -p1 < picture_controls.patch
patching file conf.c
patching file conf.h
patching file motion.c
patching file video.c
patching file video.h
Did a make clean, ./configure --without-mysql --without-pgsql, make, and make install with no complaints.
However, the new options are nowhere to be found in the new motion-dist.conf.
Has anyone gotten this to work with bttv and v4l2? I have not tried this on my box running a 2.4 kernel with v4l, just the box with the 2.6 kernel.
Thanks for the quick response.
Jim
-- JimFager - 10 Oct 2004
Jim,
I didn't patch motion-dist.conf, the settings will probably be added by the time it makes it into an offical release - and they should probably be commented out by default. To answer your question: yes it works with bttv and v4l2. My system uses kernel 2.4.26 and bttv version 0.9.15.
-- MikeLees - 10 Oct 2004
If you have XML-RPC installed you can always create perfect looking config files and all the undefined options added but commented out (or set to their default) by using motion-control.
motion-control conf write
-- KennethLavrsen - 10 Oct 2004
Mike & Kenneth, Thanks.
Re-writing motion.conf with "motion-control conf write" did not include the new parameters. However, looking at the source for the patch and seeing the new parameters added after the auto_brightness, I added the 4 new controls after the auto_brightness setting.
brightness 0
contrast 0
saturation 0
hue 50
Success!
I wasn't sure where to start with hue and added an arbitrary number. Running in non-daemon mode, I received "hue: 32768(50)" and would you believe that was the PERFECT setting for my hue problem.
Thanks a lot. All is working perfectly and I'm a happy camper!
-- JimFager - 10 Oct 2004
Patch updated to be applied against last released version 3.1.17.
-- AngelCarpintero - 18 Oct 2004
This patch still needs some work. I notice the new functions use cnt->conf.height and cnt->conf.width and we are changing those so that changes of height and width through motion-control does not happen while Motion runs since it goofs up data structures many places. There are still a few places where this changed was missed in 3.1.17.
The old error in auto brightness for (i = 0; i < cnt->conf.width * cnt->conf.height * 3; i +
100) {= is also re-introduced in this patch.
I will clean it up when I patch my new 3.1.18 sources. No need to submit more versions of this patch. It will be in the 3.1.18 snap1.
-- KennethLavrsen - 19 Oct 2004
Kenneth, the rotate patch does clean up all (AFAIK) places where width and height are used from conf
instead of imgs
. If that is cleaned up separately as well, then there will probably be problems applying the rotate patch.
-- PerJonsson - 19 Oct 2004
Actually - I was thinking that I had included the rotate patch in 3.1.17 but I had not. I just realize.
But for sure the brightness patch and rotate patch are not compatible, not matter which on you apply first. So we will need to manually merge in the rotate patch. I also plan to include the rotate patch in 3.1.18. I plan to release one snap per patch.
Next 3.1.18 snap1 will contain this patch + the Berkeley code commented out.
-- KennethLavrsen - 19 Oct 2004
Kenneth , i just reupload the file because i did an error forgetting to include # in conf.c so as soon as i realised i fixed ( that will help you even if you will merge by hand ), but i've not fixed the reintroduced error ( but i guess it should be fixed in the patch , to avoid any complaint from anyone that test it ).
About the merge of patches for 3.1.18 , that patch should be applied by hand after others is quite easy to do it as i did for 3.1.16 -> 3.1.17.
-- AngelCarpintero - 19 Oct 2004