Question

i have an array in c:

unsigned char image_in[256*256] = {
     72,  57,  55,  67,  79,  58,  52,  72,  96,  81,  72,  76,  93, 107,  91,  84,  95,  66,....IT GOES ON AND ON 256x256.....}

each value is the 8bit rgb of the indexed pixel.

now the question is how do i show this picture? i can use C or matlab or whatever..

Was it helpful?

Solution

Wops, the question is really not well formulated - there are many missing details, like: do you require a greyscale/RGB image? Do you want to do this programmatically (namely from your C-code), or just a quick one-time snapshot? Can you copy the values to some *.csv file or to a Matlab script (see Casliho's comment)?

If you just want to show the image as grayscale in Matlab, call the imshow function:

m = randint(256,256,256); % This creates a random 256x256 array of integers - replace with your values
imshow(m);                % This creates a greyscale image

From the plot object you will be able to export the image to many formats (*.jpg, *.png etc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top