[libcamera-devel] Compound libcamera controls?

Naushir Patuck naush at raspberrypi.com
Tue Jun 9 15:11:49 CEST 2020


Hi Jacopo,

On Tue, 9 Jun 2020 at 10:22, Jacopo Mondi <jacopo at jmondi.org> wrote:
>
> Hi Naush,
>
> On Tue, Jun 09, 2020 at 09:42:59AM +0100, Naushir Patuck wrote:
> > Hi,
> >
> > I've been looking to add some controls related to returning out focus
> > statistics via libcamera controls.  The simplest way to do this would
> > be to return a single numeric value to indicate the "sharpness" or
> > "contrast" of the image.
> >
> > However, I got thinking a bit more and ideally, we would like to
> > return a numeric metric for a number of zones or regions around the
> > image.  Of course, these zones could be setup by the user, so there
> > needs to be a libcamera control to setup regions.  One way to do this
> > would be to have another libcamera control to set a list of focus
> > regions.  However, as we know, libcamera controls only accept either
> > singular values or arrays, and that could be cumbersome for specifying
> > regions.  Ideally, we would want to specify a region as a struct with
> > {x, y, width, height}, and have the control accept an array of these
> > structs, together with the number of regions to be used.
> >
> > Is there any plans to extend libcamera::controls to allow compound
> > types for such use cases.  If no, any suggestions what the most
> > convenient way to specify a number of zones would be?
>
> You can do so today, if I got your request right.
>
> You can declare a control to have type 'Rectangle' (x, y,
> width, height) and assign it a 'size' (just adding the size property
> to the control yaml definition makes it a compound control).
>
> we don't have example of this in mainline libcamera, but have a look
> at some properties patches on the list, like
> "[PATCH v6] libcamera: properties: Define pixel array properties"
>
> You'll there find, in example:
>
> +  - PixelArrayOpticalBlackRectangles:
> +      type: Rectangle
> +      size: [1 x n]
> +      description: |
>
> Would you be able to handle your use case with this ? Also please note
> that you can easily access the number of entries in the control with
> ControlValue::numElements(), so there's no need to pass that as an
> additional argument to the control.

Thank you, I think this is exactly what I was looking for!  Good to
know it's already implemented :)

I'll post a patch with my proposals for AF regions soon.

Regards,
Naush


>
> Thanks
>   j
>
>
> >
> > Regards,
> > Naush
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel at lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list