Home > Enterprise >  convert data pixels to image
convert data pixels to image

Time:04-22

I have a list of X-ray output data that I want to convert to an image. These numbers are diode data. data But with the methods I test, I do not get the right image with Python. My data is as follows:

 [[(2590),(2375),(2521),(2231),(2519),(2683),(2431),(2515)..(2555)],
 [(2443),(2468),(2227),(2428),(2623),(2419),(2469),(2336),..(2435)],

.. [(2133),(2381),(2291),(2346),(2303),(2403),(2434),(2336),..(2374)] ]

I put pixels into numpy array. For example:1000*500

The size of each row and column is equal to the number of pixels in width and height. Each of number is a pixel data. Please help me how to convert?

Edit: Preliminary data:

screenshot

CodePudding user response:

You can use pyplot here:

Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.

In your particular case, The imshow(), i.e. a function in the pyplot module of the matplotlib library, is used to display data as an image, i.e. on a 2D regular raster.

Here is a smart code snippet to show data as an image:

https://app.codiga.io/hub/recipe/7884/display-data-as-an-image-python

  • Related