Class CameraConfig

  • All Implemented Interfaces:

    
    public class CameraConfig
    
                        

    Class to specify desired settings and to hold the actual used settings for the camera. (API independent)

    • Constructor Detail

      • CameraConfig

        CameraConfig()
        New instance with a default configuration for the camera.
    • Method Detail

      • updateScale

         void updateScale(int newWidth, int newHeight)
      • getFrameSize

         CameraSize getFrameSize()
        Returns:

        the size of the preview frame (pixels of the full preview image)

      • getFrameWidth

         int getFrameWidth()
        Returns:

        the preview frame width in pixels

      • getFrameHeight

         int getFrameHeight()
        Returns:

        the preview frame height in pixels

      • getFrameToViewScale

         float getFrameToViewScale()
        Returns:

        the scale factor (scale * frame size = view size)

      • setPreviewSize

         void setPreviewSize(@Nullable() CameraSize previewSize)

        Set the preview size that should be used by the camera

        Parameters:
        previewSize - the desired preview size
      • setHighResolutionPictureSize

         void setHighResolutionPictureSize(@Nullable() CameraSize highResImageSize)

        Set the size for high resolution images that should be used by the camera

        Parameters:
        highResImageSize - the desired picture size
      • isFocusModeAuto

         boolean isFocusModeAuto()
        Returns:

        true if the focus mode of this settings is a mode that requires manual autofocus calls (auto or macro)

      • setSceneMode

         void setSceneMode(@NonNull() CameraFeatures.SceneMode sceneMode)

        Set the scene mode that should be used.

        WARNING: Scene mode behavior is device dependent and it may overrule all the other focus and auto exposure settings. Usage NOT recommended.

        Parameters:
        sceneMode - the scene mode to use (if available)
      • setFocusRegionEnabled

         void setFocusRegionEnabled(boolean focusRegionEnabled)

        Set to true to use the region where the cutout is for focusing.

        Parameters:
        focusRegionEnabled - true to enable
      • setAutoExposureRegionEnabled

         void setAutoExposureRegionEnabled(boolean autoExposureRegionEnabled)

        Set to true to use the region where the cutout is for auto exposure calculation.

        Parameters:
        autoExposureRegionEnabled - true to enable
      • isFocusOnTouchEnabled

         boolean isFocusOnTouchEnabled()
        Returns:

        true if focus on touch is enabled (only relevant if focus mode is auto or macro)

      • setFocusOnTouchEnabled

         void setFocusOnTouchEnabled(boolean focusOnTouchEnabled)

        Set to true if focus on touch should be enabled (only relevant if focus mode is auto or macro)

        Parameters:
        focusOnTouchEnabled - true to enable
      • setUpdateRegionsOnAutoFocusEnabled

         void setUpdateRegionsOnAutoFocusEnabled(boolean updateRegionsOnAutoFocusEnabled)

        Set to true if regions should be changed slightly before every auto focus call. Only relevant if isFocusModeAuto and isFocusRegionEnabled. (Some devices require slight change in the region or they don't work).

        Parameters:
        updateRegionsOnAutoFocusEnabled - true to enable
      • setVideoStabilizationEnabled

         void setVideoStabilizationEnabled(boolean videoStabilizationEnabled)

        Set if software video stabilization should be used.

        Note: this will be ignored if optical stabilization is also enabled and available (they are mutually exclusive and optical should be better)

        Parameters:
        videoStabilizationEnabled - true if software video stabilization should be used
      • getAutoFocusInterval

         int getAutoFocusInterval()
        Returns:

        the interval in millis the auto focus should be called in (or <= 0 if not used)

      • setAutoFocusInterval

         void setAutoFocusInterval(int autoFocusInterval)

        Set the interval in millis the auto focus should be called in (or <= 0 if it should not be used). This will only have an effect if the focus mode is AUTO or MACRO. (Minimum step size is 500ms).

        Parameters:
        autoFocusInterval - the interval in milliseconds
      • isZoomGestureEnabled

         boolean isZoomGestureEnabled()

        Get boolean if zoom gesture is enabled

        Returns:

        zoomGestureEnabled

      • setZoomGestureEnabled

         void setZoomGestureEnabled(boolean zoomGestureEnabled)

        Enable the Gesture for pinch to zoom

      • getFocalLength

         double getFocalLength()

        Get the current focal length

        Returns:

        focalLength

      • setFocalLength

         void setFocalLength(double focalLength)

        Set a focal length to the camera

      • getZoomRatio

         double getZoomRatio()

        Get the current zoom ratio

        Returns:

        zoomRatio

      • setZoomRatio

         void setZoomRatio(double zoomRatio)

        Set a zoom Ratio to the camera

      • getMaxFocalLength

         double getMaxFocalLength()

        Get the naximum focal length

        Returns:

        zoomGestureEnabled

      • setMaxFocalLength

         void setMaxFocalLength(double maxFocalLength)

        Set a custom maximum focal Length

      • getMaxZoomRatio

         double getMaxZoomRatio()

        Get boolean if zoom gesture is enabled

        Returns:

        zoomGestureEnabled

      • setMaxZoomRatio

         void setMaxZoomRatio(double maxZoomRatio)

        Set a custom maximum zoom Ratio

      • setFallbackLensFacings

         void setFallbackLensFacings(Array<CameraFeatures.LensFacing> fallbackLensFacings)

        Set the fallback camera facings which are used if the default camera facing is not available on the device

        Parameters:
        fallbackLensFacings - the fallback options for CameraFacing
      • setFallbackLensFacings

         void setFallbackLensFacings(EnumSet<CameraFeatures.LensFacing> fallbackLensFacings)

        Set the fallback camera facings which are used if the default camera facing is not available on the device

        Parameters:
        fallbackLensFacings - the fallback options for CameraFacing