彩色图像增强


#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;
}

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值