Convert gray surface image to color (according to xray color code of each material)

247 views Asked by At

I wrote a software to connect to the xray luggage inspection machine and receive the scanned images.

But these images are on a gray level and should be turned into a color photo.

Of course, the desired color photo must be with xray color code, which is different according to the category of materials. My output data from the device is as follows:

enter image description here

I convert this data to an image with the following Python code:

    input_arr = np.array(input) # converting the list of lists to numpy array
    input_arr_rescaled = (255.0 / input_arr.max() * (input_arr - input_arr.min())).astype(np.uint8)
    plt.imshow(input_arr) # visualization with matplotlib
    # for saving the matrix itself
    from PIL import Image
    im = Image.fromarray(input_arr_rescaled )
    im.save("image.png")

Sample output image:

enter image description here

Sample output image of xray device:

enter image description here

My other question is how can I delete the image of the conveyor?

0

There are 0 answers