robokudo.annotators.cluster_color ================================= .. py:module:: robokudo.annotators.cluster_color Classes ------- .. autoapisummary:: robokudo.annotators.cluster_color.Color robokudo.annotators.cluster_color.ClusterColorAnnotator Module Contents --------------- .. py:class:: Color Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: RED :value: (0,) .. py:attribute:: YELLOW :value: (1,) .. py:attribute:: GREEN :value: (2,) .. py:attribute:: CYAN :value: (3,) .. py:attribute:: BLUE :value: (4,) .. py:attribute:: MAGENTA :value: (5,) .. py:attribute:: WHITE :value: (6,) .. py:attribute:: BLACK :value: (7,) .. py:attribute:: GREY :value: (8,) .. py:class:: ClusterColorAnnotator(name='ClusterColorAnnotator', descriptor=Descriptor()) Bases: :py:obj:`robokudo.annotators.core.BaseAnnotator` Calculate the semantic color for every Object Hypothesis (cluster) that has a RGB ROI and a Mask .. py:class:: Descriptor Bases: :py:obj:`robokudo.annotators.core.BaseAnnotator.Descriptor` .. py:class:: Parameters .. py:attribute:: num_of_colors :value: 6 .. py:attribute:: color_range :value: 42.666666666666664 .. py:attribute:: jit_compile_on_init :value: False .. py:attribute:: min_value_color :value: 60 .. py:attribute:: min_saturation_color :value: 60 .. py:attribute:: max_value_black :value: 60 .. py:attribute:: min_value_white :value: 120 .. py:attribute:: ratio_annotation_threshold :value: 0.2 .. py:attribute:: analysis_scope .. py:attribute:: parameters .. py:attribute:: color_name_to_bgr_values .. py:attribute:: color_hue_positions .. py:attribute:: cluster_color_info :value: [] .. py:attribute:: cluster_rois :value: [] .. py:method:: count_colors_numba(hsv_image: numpy.typing.NDArray, mask: numpy.typing.NDArray) -> (int, dict) Wrapper function for the numba version of the count colors method. The wrapper handles the pythonic/object style data and prepares everything for the requirements of the numba method. :param hsv_image: :param mask: :return: A tuple with the number of analyzed pixels (given by the mask) as well as a dict with the counted colors. The key is a Color enum from this module. .. py:method:: count_colors_numba_impl(hsv_image: numpy.typing.NDArray, mask: numpy.typing.NDArray, total_amount_of_colors: int, min_saturation_color: int, min_value_color: int, max_value_black: int, min_value_white: int, number_of_colors: int, color_range: float) -> (int, numpy.typing.NDArray) :staticmethod: Iterate over the masked pixels on a given hsv image to count how many pixels can be assigned to the defined color ranges. Requires the numba library and passes the required parameters to avoid class access and object-mode from numba. :param hsv_image: :param mask: :param total_amount_of_colors: :param min_saturation_color: :param min_value_color: :param max_value_black: :param min_value_white: :param number_of_colors: :param color_range: :return: A tuple with the number of analyzed pixels (given by the mask) as well as a numpy array with the counted colors. The id refers the indices of the Color enum from this module. .. py:method:: count_colors(hsv_image: numpy.typing.NDArray, mask: numpy.typing.NDArray) -> (int, dict) Non-numba version of the count_colors_numba_impl method. Use only if you can't use numba. Warning: Seems to contain a bug in color counting. :param hsv_image: :param mask: :return: .. py:method:: update() .. py:method:: create_color_annotations(color) .. py:method:: draw_visualization(visualization_img)