float array to ofImage

Hi,
I am having perlin noise as an array of float values, I want to convert it in to a gray scale image to visualise.
How can I assign individual values to fill the values as pixels. I can’t convert it to unsigned char*.

Please Help.
Regards,
Paras

you have to do a casting. something like this:

  
   
    float 	* m_Buffer ;  
    m_Buffer			= new float[w*h]  
  
  
		for(int y=0; y<h; y++)  
		{  
			  
			  
				  
				unsigned char pixels = ofMap(fIntensity,-1.0,1.0,0,255);  
					  
				((unsigned char *)m_Buffer)[n++] = pixels;  
		  
		}