Re: Image capture triggers a focus event at the worst possible time




On Mon, 14 Mar 2016 17:20:28 +0000
John Nash wrote:

If you find anything more, keep in touch. I'll try to find the
communication re: UVC codes.

JN

So... I found out that when this particular camera "changes
modes" (in such a way that is barely within Cheese's reach; see below)
it triggers an auto-focus.

On Fri, 18 Mar 2016 09:10:43 +0100
Dimitrios Katsaros <patcherwork gmail com> wrote:

Hello,

The camerabin in its self does not have support for autofocus, at
least none that I am aware of. Are you using v4l2src with
wrappercamerabinsrc? If that is the case I would suspect that the
problem is renegotiation on capture. When a new capture is performed,
the pipeline is dynamically changed to feed the image output path.
That procs a renegotiaion. If the caps on the video/image output are
different than the viewfinder, a new set_fmt is performed in v4l2,
which resets the v4l2 controls and in turn resets the focus. to
verify/fix that you can do something like:

  g_object_set (camerabin_object,
    "viewfinder-caps", gst_caps_from_string(caps),
    "image-capture-caps", gst_caps_from_string(caps),
    "video-capture-caps", gst_caps_from_string(caps),
    NULL);


Make sure the caps string is the same for all 3.

I am sort of able to work around the issue by using a "pristine"
version of libcheese from fedora rawhide, but if I change either of the
capture resolutions (even if I change it back!) the focus bug pops up
again.

This is a bit to precarious to be in my workflow, so I'm going to try
and find a solution derived from camorama (which has it's own
problems but does not exhibit this behavior).

Apart from a "keeping the caps string perfectly the same" feature, this
might be closer to the fault:

libcheese/cheese-camera.c:122

 caps = gst_caps_new_simple ("video/x-raw-rgb",
                             "bpp", G_TYPE_INT, 24,
                             "depth", G_TYPE_INT, 24,
                             NULL);
 g_object_set (G_OBJECT (priv->camerabin), "preview-caps", caps,
NULL); gst_caps_unref (caps);

I'm not sure exactly why this would be needed here (in the take-photo
function), but this mode change might actually be what is causing the
refocus (it's hard for me to tell, because I have yet to successfully
compile cheese and there is no option/flag/environment-variable that
bypasses this signal).

-- 
Robert Hailey





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]