I have loaded a 100x100 rgb image in a numpy array. I then converted it to a 30000x1 numpy array to pass through a machine learning model. The output of this model is also a 30000x1 numpy array. How do I convert this array back to a numpy array of 100x100 3-tuples so I can print the generated rgb image?
If the initial array is [r1 g1 b1],[r2 g2 b2],...,[], it is unrolled to [r1 g1 b1 r2 g2 b2 ...]. I need it back in the form [r1 g1 b1],[r2 g2 b2],...,[].
What I used to load the image as array:
im=img.resize((height,width), Image.ANTIALIAS);
im=np.array(im);
im=im.ravel();
I have tried .reshape((100,100,3)) and I'm getting a black output image. The machine learning model is correct and it is not the reason for getting a black output.
reshapeseems correct (try it with the initial array). How are you converting to RGB, maybe the problem is there?imgarray and reshaping it into 100x100 and storing it inim