紧急求助,如何将保存RGB值的数组,转化成一张BMP图像并且显示,在线等待

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

 
  我对一张24位bmp图像进行了优化,得到了3个保存有其rgb值的数组,数组类型为float型,但是我不知道该如何将其还原为一张图像,并且显示出来。  
   
  这个问题也行对你很简单,但是对我很难,所以在此请求各位大大帮个忙,谢谢了  
   
  这是读图的,然后我将它转化后保存在分别存储r,g,b值的3个数组里头,数组类型为float。  
   
  void   ctestview::ondraw(cdc*   pdc)  
  {  
  beginwaitcursor();  
  m_dibresource.usepalette(pdc);   //   should   be   in   palette  
  m_dibfile.usepalette(pdc);           //     message   handlers,   not   here  
  pdc->textout(0,   0,  
  "click   the   left   mouse   button   here   to   load   a   file.");  
  csize   sizeresourcedib   =   m_dibresource.getdimensions();  
  sizeresourcedib.cx   *=   30;  
  sizeresourcedib.cy   *=   -30;  
  m_dibresource.draw(pdc,   cpoint(0,   -800),   sizeresourcedib);  
  csize   sizefiledib   =   m_dibfile.getdimensions();  
  sizefiledib.cx   *=   30;  
  sizefiledib.cy   *=   -30;  
  m_dibfile.draw(pdc,   cpoint(1800,   -800),   sizefiledib);  
  endwaitcursor();  
  }  
   
  void   ctestview::oninitialupdate()  
  {  
  cscrollview::oninitialupdate();  
  csize   sizetotal(30000,   40000);   //   30-by-40   cm  
  csize   sizeline   =   csize(sizetotal.cx   /   100,   sizetotal.cy   /   100);  
  setscrollsizes(mm_himetric,   sizetotal,   sizetotal,   sizeline);  
  cclientdc   dc(this);  
  trace("bits   per   pixel     =   %d\n",   dc.getdevicecaps(bitspixel));  
  }  
   
  接下来这个是我对上面获得的3个数组进行直方图均衡化的过程  
  void   ctestview::zhifangtu(float   n[])  
  {  
  //   各分量中i灰度级出现的概率  
  float   ps[256]   ;  
  dword   m_dwfilelen   =   pbitmap.getsize();  
  for   (int   i=0;i<256;i++)  
  {        
  //ps[i]=0;  
  ps[i]=n[i]/((m_dwfilelen-54)/3.0f);    
  }  
  //各灰度级的累计直方图分布:    
          float   temp[256]   ;  
          for   (int   j=0;j<256;j++)  
  {    
  temp[0]=ps[0];  
  temp[j]=temp[j-1]+ps[j];  
   
  //对其进行取整以得出源和目标图像灰度之间的映射关系  
  n[j]=(int)(255.0f*temp[j]+0.5f);    
  }  
   
  }  
   
  得到经过处理的r,g,b数组,但是我不知道怎么将其转化成一张图表示出来!  
  期望各位帮帮忙啊

.

· 网友精彩回答:

处理 SSI 文件时出错
© 2006-2008 All Rights Reserved