{'fraction_non_alphanumeric': 0.015873015873015872, 'fraction_numerical': 0.0007936507936507937, 'mean_word_length': 5.181372549019608, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Color to grayscale transform preserving natural order of hues

Color-to-gray conversion in many applications requires preserving both the visual appearance and feature discrimination of color images. The existing methods are still need of improvement in these aspects. A two-stage color-to-gray transform algorithm is proposed in this paper. It produces a grayscale image that matches the color contrast and the lightness of a given input color imag1e. The first stage process is a functional mapping scheme based on the natural order of hues. The mapping is simple and fast, yet it preserves feature discrimination and appropriate color order of color images. The second stage of the proposed algorithm recovers the lightness of a color image through adjusting the local contrast of the first-stage output. It not only retains the visual appearance of the color image but also compensates the functional mapping for possible loss of color information. The proposed method could accurately convert various categories of color images to grayscale images, including natural images, computational images, and painting images. Experimental results show that our method produced perceptually accurate and preferred images when they were compared with other schemes.