Ejemplo n.º 1
0
def to_internal_settings(settings):
    internal_settings = _zivid.Settings()

    internal_settings.processing = to_internal_settings_processing(
        settings.processing)

    temp = _zivid.Settings().Acquisitions()
    for acq in settings.acquisitions:
        temp.append(to_internal_settings_acquisition(acq))
    internal_settings.acquisitions = temp

    return internal_settings
Ejemplo n.º 2
0
            def __init__(
                self,
                enabled=_zivid.Settings().filters.outlier.enabled.value,
                threshold=_zivid.Settings().filters.outlier.threshold.value,
            ):
                """Initialize outlier filter.

                Args:
                    enabled: a bool
                    threshold: a real number

                """
                self.enabled = enabled
                self.threshold = threshold
Ejemplo n.º 3
0
            def __init__(
                self,
                enabled=_zivid.Settings().filters.gaussian.enabled.value,
                sigma=_zivid.Settings().filters.gaussian.sigma.value,
            ):
                """Initialize gaussian filter.

                Args:
                    enabled: a bool
                    sigma: a real number

                """
                self.enabled = enabled
                self.sigma = sigma
Ejemplo n.º 4
0
    def __init__(  # pylint: disable=too-many-arguments
        self,
        bidirectional=_zivid.Settings().bidirectional.value,
        blue_balance=_zivid.Settings().bluebalance.value,
        brightness=_zivid.Settings().brightness.value,
        exposure_time=_zivid.Settings().exposuretime.value,
        filters=Filters(),
        gain=_zivid.Settings().gain.value,
        iris=_zivid.Settings().iris.value,
        red_balance=_zivid.Settings().redbalance.value,
    ):
        """Initialize saturated filter.

        Args:
            bidirectional: a bool
            blue_balance: a real number
            brightness: a real number
            exposure_time: a datetime.timedelta object
            filters: a filters object
            gain: a real number
            iris: an int
            red_balance: a real number

        """
        self.bidirectional = bidirectional
        self.blue_balance = blue_balance
        self.brightness = brightness
        self.exposure_time = exposure_time
        self.filters = filters
        self.gain = gain
        self.iris = iris
        self.red_balance = red_balance
Ejemplo n.º 5
0
            def __init__(
                self, enabled=_zivid.Settings().filters.reflection.enabled.value
            ):
                """Initialize reflection filter.

                Args:
                    enabled: a bool

                """
                self.enabled = enabled
Ejemplo n.º 6
0
            def __init__(
                self, enabled=_zivid.Settings().filters.saturated.enabled.value
            ):
                """Initialize saturated filter.

                Args:
                    enabled: a bool

                """
                self.enabled = enabled
Ejemplo n.º 7
0
    def __init__(
        self,
        acquisitions=None,
        processing=None,
    ):
        if acquisitions is None:
            acquisitions = _zivid.Settings().Acquisitions().value
        if not isinstance(acquisitions, collections.abc.Iterable):
            raise TypeError(
                "Unsupported type: {value}".format(value=type(acquisitions)))
        self._acquisitions = _convert_to_acquistions(acquisitions)

        if processing is None:
            processing = zivid.Settings2D.Processing()
        if not isinstance(processing, zivid.Settings2D.Processing):
            raise TypeError(
                "Unsupported type: {value}".format(value=type(processing)))
        self._processing = processing
Ejemplo n.º 8
0
def to_internal_settings(settings):
    """Convert settings type to internal settings type.

    Args:
        settings: a settings object

    Returns:
        an internal settings object

    """
    def to_internal_bidirectional(bidirectional):
        return _zivid.Settings.Bidirectional(bidirectional)

    def to_internal_blue_balance(blue_balance):
        return _zivid.Settings.BlueBalance(blue_balance)

    def to_internal_brightness(brightness):
        return _zivid.Settings.Brightness(brightness)

    def to_internal_exposure_time(exposure_time):
        return _zivid.Settings.ExposureTime(exposure_time)

    def to_internal_gain(gain):
        return _zivid.Settings.Gain(gain)

    def to_internal_iris(iris):
        return _zivid.Settings.Iris(iris)

    def to_internal_red_balance(red_balance):
        return _zivid.Settings.RedBalance(red_balance)

    def to_internal_filters(filters):
        internal_filters = _zivid.Settings.Filters()
        internal_filters.contrast = to_internal_contrast(filters.contrast)
        internal_filters.outlier = to_internal_outlier(filters.outlier)
        internal_filters.saturated = to_internal_saturated(filters.saturated)
        internal_filters.reflection = to_internal_reflection(
            filters.reflection)
        internal_filters.gaussian = to_internal_gaussian(filters.gaussian)
        return internal_filters

    def to_internal_contrast(contrast):
        internal_contrast = _zivid.Settings.Filters.Contrast()
        internal_contrast.enabled = _zivid.Settings.Filters.Contrast.Enabled(
            contrast.enabled)
        internal_contrast.threshold = _zivid.Settings.Filters.Contrast.Threshold(
            contrast.threshold)
        return internal_contrast

    def to_internal_outlier(outlier):
        internal_outlier = _zivid.Settings.Filters.Outlier()
        internal_outlier.enabled = _zivid.Settings.Filters.Outlier.Enabled(
            outlier.enabled)
        internal_outlier.threshold = _zivid.Settings.Filters.Outlier.Threshold(
            outlier.threshold)
        return internal_outlier

    def to_internal_saturated(saturated):
        internal_saturated = _zivid.Settings.Filters.Saturated()
        internal_saturated.enabled = _zivid.Settings.Filters.Saturated.Enabled(
            saturated.enabled)
        return internal_saturated

    def to_internal_reflection(reflection):
        internal_reflection = _zivid.Settings.Filters.Reflection()
        internal_reflection.enabled = _zivid.Settings.Filters.Reflection.Enabled(
            reflection.enabled)
        return internal_reflection

    def to_internal_gaussian(gaussian):
        internal_gaussian = _zivid.Settings.Filters.Gaussian()
        internal_gaussian.enabled = _zivid.Settings.Filters.Gaussian.Enabled(
            gaussian.enabled)
        internal_gaussian.sigma = _zivid.Settings.Filters.Gaussian.Sigma(
            gaussian.sigma)
        return internal_gaussian

    internal_settings = _zivid.Settings()
    internal_settings.bidirectional = to_internal_bidirectional(
        settings.bidirectional)
    internal_settings.bluebalance = to_internal_blue_balance(
        settings.blue_balance)
    internal_settings.brightness = to_internal_brightness(settings.brightness)
    internal_settings.exposuretime = to_internal_exposure_time(
        settings.exposure_time)
    internal_settings.filters = to_internal_filters(settings.filters)
    internal_settings.gain = to_internal_gain(settings.gain)
    internal_settings.iris = to_internal_iris(settings.iris)
    internal_settings.redbalance = to_internal_red_balance(
        settings.red_balance)
    return internal_settings