#include "BMP.h"
BMP_Image* PseudoColor(BMP_Image* Image_In)
{
BMP_Image* Image_PseudoColor;
Image_PseudoColor = (BMP_Image*)malloc(sizeof(BMP_Image));
Image_PseudoColor->width = Image_In->width;
Image_PseudoColor->height = Image_In->height;
Image_PseudoColor->biBitCount = 24;
Image_PseudoColor->imageData = (unsigned char*)malloc(Image_In->height*Image_In->width*3);
int i;
for (i=0; i<Image_In->height*Image_In->width; i++)
{
int Image_In_Pixel = Image_In->imageData[i];
int Image_PseudoColor_b ;
int Image_PseudoColor_g ;
int Image_PseudoColor_r ;
Image_PseudoColor->imageData[i*3] = Image_PseudoColor_b;
Image_PseudoColor->imageData[i*3+1] = Image_PseudoColor_g;
Image_PseudoColor->imageData[i*3+2] = Image_PseudoColor_r;
//***********¶ÔbgrͨµÀ¸³Öµ***********//
//¶ÔBͨµÀ´¦Àí
if(Image_In_Pixel < 64)
/********* Begin *********/
Image_PseudoColor_b = 255;
/********* End *********/
else if(Image_In_Pixel< 128)
/********* Begin *********/
Image_PseudoColor_b = -255/64 * (Image_In_Pixel - 64) + 255 ;
/********* End *********/
else
/********* Begin *********/
Image_PseudoColor_b = 0;
/********* End *********/
//¶ÔGͨµÀ´¦Àí
if(Image_In_Pixel < 64)
/********* Begin *********/
Image_PseudoColor_g = 255/64 * Image_In_Pixel;
/********* End *********/
else if(Image_In_Pixel < 192)
/********* Begin *********/
Image_PseudoColor_g = 255 ;
/********* End *********/
else
/********* Begin *********/
Image_PseudoColor_g = -255/64 * (Image_In_Pixel -192) + 255 ;
/********* End *********/
//¶ÔRͨµÀ´¦Àí
if(Image_In_Pixel < 128)
/********* Begin *********/
Image_PseudoColor_r = 0;
/********* End *********/
else if(Image_In_Pixel < 192)
/********* Begin *********/
Image_PseudoColor_r = 255/64 * (Image_In_Pixel -128);
/********* End *********/
else
/********* Begin *********/
Image_PseudoColor_r = 255 ;
/********* End *********/
}
return Image_PseudoColor;
}
彩色图像增强
最新推荐文章于 2023-12-29 01:44:10 发布