无线图像传输系统ARM9+Atmega16+OV7620+
gressive sCAN mode
下面是Bayer转RGB24的算法(在液晶屏上显示时还要转为RGB16):
void bayer2rgb24(unsigned char *dst, unsigned char *SRC, long WIDTH, long HEIGHT)
{
long int i;
unsigned char *rawpt, *scanpt;
long int size;
rawpt = src;
scanpt = dst;
size = WIDTH*HEIGHT;
for ( i = 0; i size; i++ )
{
if ( (i/WIDTH) % 2 == 0 ) //奇数行
{
if ( (i % 2) == 0 ) //奇数列
{
/* B */
if ( (i > WIDTH) ((i % WIDTH) > 0) )
{
*scanpt++ = ((long int)*(rawpt-WIDTH-1)+(long int)*(rawpt-WIDTH+1)+
(long int)*(rawpt+WIDTH-1)+(long int)*(rawpt+WIDTH+1))/4; /* R */
*scanpt++ = ((long int)*(rawpt-1)+(long int)*(rawpt+1)+
(long int)*(rawpt+WIDTH)+(long int)*(rawpt-WIDTH))/4; /* G */
*scanpt++ = *rawpt; /* B */
}
else /* first line or left column */
{
*scanpt++ = *(rawpt+WIDTH+1); /* R */
*scanpt++ = ((long int)*(rawpt+1)+(long int)*(rawpt+WIDTH))/2; /* G */
*scanpt++ = *rawpt; /* B */
}
}
else
{
/* (B)G */
if ( (i > WIDTH) ((i % WIDTH) (WIDTH-1)) )
{
*scanpt++ = ((long int)*(rawpt+WIDTH)+(long int)*(rawpt-WIDTH))/2; /* R */
*scanpt++ = *rawpt; /* G */
*scanpt++ = ((long int)*(rawpt-1)+(long int)*(rawpt+1))/2; /* B */
}
else /* first line or right column */
{
*scanpt++ = *(rawpt+WIDTH); /* R */
*scanpt++ = *rawpt; /* G */
*scanpt++ = *(rawpt-1); /* B */
}
}
}
else //偶数行
{
if ( (i % 2) == 0 ) //奇数列
{
/* G(R) */
if ( (i (WIDTH*(HEIGHT-1))) ((i % WIDTH) > 0) )
{
*scanpt++ = ((long int)*(rawpt-1)+(long int)*(rawpt+1))/2; /* R */
*scanpt++ = *rawpt; /* G */
*scanpt++ = ((long int)*(rawpt+WIDTH)+(long int)*(rawpt-WIDTH))/2; /* B */
}
else
{
/* bottom line or left column */
*scanpt++ = *(rawpt+1); /* R */
*scanpt++ = *rawpt; /* G */
*scanpt++ = *(rawpt-WIDTH); /* B */
}
}
else
{
/* R */
if ( i (WIDTH*(HEIGHT-1)) ((i % WIDTH) (WIDTH-1)) )
{
*scanpt++ = *rawpt; /* R */
*scanpt++ = ((long int)*(rawpt-1)+(long int)*(rawpt+1)+
(long int)*(rawpt-WIDTH)+(long int)*(rawpt+WIDTH))/4; /* G */
*scanpt++ = ((long int)*(rawpt-WIDTH-1)+(long int)*(rawpt-WIDTH+1)+
(long int)*(rawpt+WIDTH-1)+(long int)*(rawpt+WIDTH+1))/4; /* B */
} else {
/* bottom line or right column */
*scanpt++ = *rawpt; /* R */
*scanpt++ = ((long int)*(rawpt-1)+(long int)*(rawpt-WIDTH))/2; /* G */
*scanpt++ = *(rawpt-WIDTH-1); /* B */
}
}
}
rawpt++;
}
}
- 基于Atmel AVR单片机的无线图像侦检系统(10-19)
- 基于AD9268的短波接收全数字传输结构(07-25)
- 基于 DSP-dMAX 的嵌入式 FIFO 数据传输系统设计(04-11)
- 基于DSP的HPI接口的视频数据传输系统设计(03-01)
- 用FPGA在数字电视系统中进行级联编码(06-06)
- 多路数字视频光纤传输系统的设计,软硬件架构(06-04)