def rgb2gray(image_rgb_array):
image_gray_array = [<NUM_LIT:0.0>] * len(image_rgb_array);<EOL>for index in range(<NUM_LIT:0>, len(image_rgb_array), <NUM_LIT:1>):<EOL><INDENT>image_gray_array[index] = float(image_rgb_array[index][<NUM_LIT:0>]) * <NUM_LIT> + float(image_rgb_array[index][<NUM_LIT:1>]) * <NUM_LIT> + float(image_rgb_array[index][<NUM_LIT:2>]) * <NUM_LIT>;<EOL><DEDENT>return image_gray_array<EOL>
!
    @brief Returns image as 1-dimension (gray colored) matrix, where one element of list describes pixel.
    @details Luma coding is used for transformation and that is calculated directly from gamma-compressed primary intensities as a weighted sum:

    \f[Y = 0.2989R + 0.587G + 0.114B\f]

    @param[in] image_rgb_array (list): Image represented by RGB list.

    @return (list) Image as gray colored matrix, where one element of list describes pixel.

    @code
        colored_image = read_image(file_name);
        gray_image = rgb2gray(colored_image);
    @endcode

    @see read_image()