rightlosa.blogg.se

Color extract software
Color extract software












color extract software color extract software

Positions where the color in question has been detected contain the original RGB color found in the source image other positions have the value 0 (black), except in the case of the "achro(matic)" color, where they have the value 1 (white). Each such array has the same horizontal and vertical dimensions as the source image. The function get_rgb_arrays returns a dictionary with a RGB array for each color. > color_extraction.get_bool_arrays(img, color_def_path=path_to_your_json_file) It is also possible to use your own color definitions saved in a JSON file. It is also possible to use a median filter (3 x 3) in order to reduce the amount of pixels of a given color that are isolated in the array: > color_extraction.get_bool_arrays(img, median_filter=True) (output_path + color + ".png", dict_bool_arrays, cmap='gray') > dict_bool_arrays = color_extraction.get_bool_arrays(img) Each such array has the same horizontal and vertical dimensions as the source image and can be thought of as a mask for the color in question. The function get_bool_arrays returns a dictionary with a boolean ndarray for each color. > with _sample_data('ada.png') as image_file: To get started: > import color_extraction This set of colors, which can be modified, is available at Orange, yellow, green, cyan, blue, purple, pink, achromatic (gray and black),Īnd white. Installing > pip install color_extractionĪ predefined set of colors is included in the module with ten colors: red, Three functions are included, each of which takes an RGB ndarray as input and returns a dict whose keys are the names of each predefined color: Function

color extract software

Color-extraction is an open-source python module which attributes to each element of an ndarray (RGB image) the most similar color from a palette of predefined colors.














Color extract software