cmos sensor gc0329 raw data只能输出黑白图片

勋锅的笔记 2018-11-13 02:56:56
采用cmos sensor gc0329。将gc0329的输出格式设置为raw data(Bayer pattern)。无论是color bar还是拍摄实物,都只能输出黑白的图片,无法输出彩色的图片。

寄存器配置给吃gc0329.c:

static const uint8_t default_regs[][2] = {

{ Reset_related , 0x80},
{ clk_div_mode,0x01},
{ Reset_related, 0x00},

{ Global_gain, 0x48},
{ Channel_gain_R, 0x90},
{ Channel_gain_G1, 0x80},
{ Channel_gain_G2, 0x80},
{ Channel_gain_B, 0x94},
{ AWB_R_gain, 0x62},
{ AWB_G_gain,0x47},
{ AWB_B_gain, 0x40},

{ Exposure_high , 0x0c},
{ Exposure_low , 0xa8},


//////////////// ANALOG ////////////////
{ Analog_pwc, 0x16},

{ Row_start_high, 0x00}, //Row_start 120
{ Row_start_low, 0x00},//0x02 0x78
{ Column_start_high, 0x00},//Column_start 200
{ Column_start_low, 0x50},//0x02 0xc8
{ window_heigth_high, 0x01},//win_height high 0x01 0x00
{ window_heigth_low, 0xe8},//248 win_height low 0xe8 0xf8
{ window_width_high, 0x01},//win_width high 0x02 0x00
{ window_width_low, 0xfc},//248 win_width low 0x88
{ 0x59, 0x22},
{ 0x5a, 0x03},
{ 0x5b, 0x00},
{ 0x5c, 0x00},
{ 0x5d, 0x00},
{ 0x5e, 0x00},
{ 0x5f, 0x00},
{ 0x60, 0x00},
{ 0x61, 0x00},
{ 0x62, 0x00},

{ CISCTL_mode1, 0x17},//0x14
{ CISCTL_mode3, 0x05},
{ Rsh_width, 0x24},
{ Tsp_width, 0x04},
{ Analog_mode3, 0x08},
{ Analog_mode4, 0x08},//0xc8
{ Analog_mode5, 0x01},
{ Analog_mode6, 0x48},
{ Analog_mode7, 0xba},
{ Analog_mode8, 0x22},
{ Pad_driver, 0x16},


//////////////////// blk(P0) //////////////////
{ Blk_mode1, 0xf7},//BLk
{ BLK_limit_value, 0x7f},//BLK limit
{ global_offset, 0x00},
{ Exp_rate_darkc, 0x00},//04 darkc
{ offset_ratio_G1, 0x20},//blk ratio
{ offset_ratio_G2, 0x20},
{ offset_ratio_R1, 0x20},
{ offset_ratio_B2, 0x20},

{ manual_R1_offset, 0x04},//manual offset
{ manual_G1_offset, 0x04},
{ manual_G2_offset, 0x04},
{ manual_B2_offset, 0x04},

//////////////////// ISP BLOCK ENABLE //////////////////
{ Block_enable_1, 0xff},
{ Block_enable_2, 0x24},//[5]skin detection
{ AAAA_enable, 0xfe},// 0xfa
{ special_effect,0x00},
{ Sync_mode, 0x0f},
{ Debug_mode1, 0xca},

{ Debug_mode2,0x00},
{ Debug_mode3, 0x01},
{ AEC_EN, 0x01},
{ Globel_gain, 0x48},

////////////////////DNDD////////////////////
{ DN_mode_en, 0x07},//0xe7
{ DN_mode_ratio , 0xc2},//0x22
{ DN_bilat_b_base, 0x90},//DN auto DNDD DEC DNDD //0e //55 jambo
{ DN_bilat_n_base, 0x05},
{ DN_b_in_dark1, 0x40},// 0x4a

////////////////////INTPEE////////////////////
{ EEINTP_mode1, 0x8c},//ac
{ Direction_TH1, 0x05},
{ Diff_HV_TI_TH, 0x05},
{ Edge_effect, 0x45},//0x44
{ Edge_pos_ratio, 0x88},



////////////////////ASDE////////////////////
{ Reset_related , 0x01},
{ AEC_luma_div, 0x22},
{ Reset_related , 0x00},
{ ASDE_DN_b_slope, 0x0a},
{ ASDE_DD_bright, 0xaf},
{ ASDE_EE1_effect, 0xff},
{ ASDE_auto_saturation, 0x30},//50 jambo
{ ASDE_sub_saturation, 0x31},
{ ASDE_low_luma_value, 0x35},

////////////////////RGB gamma////////////////////
{ Reset_related, 0x00},
{ Gamma_0, 0x0b},
{ Gamma_1, 0x1d},
{ Gamma_2, 0x33},
{ Gamma_3, 0x49},
{ Gamma_4, 0x5d},
{ Gamma_5, 0x6e},
{ Gamma_6, 0x7c},
{ Gamma_7, 0x99},
{ Gamma_8, 0xaf},
{ Gamma_9, 0xc2},
{ Gamma_10, 0xd0},
{ Gamma_11, 0xda},
{ Gamma_12, 0xe2},
{ Gamma_13, 0xe7},
{ Gamma_14, 0xf0},
{ Gamma_15, 0xf7},
{ Gamma_16, 0xff},

////////////////////Y gamma////////////////////
{ Reset_related, 0x00},
{ Y_Gamma_0, 0x00},
{ Y_Gamma_1, 0x06},
{ Y_Gamma_2, 0x0d},
{ Y_Gamma_3, 0x1b},
{ Y_Gamma_4, 0x2b},
{ Y_Gamma_5, 0x3d},
{ Y_Gamma_6, 0x50},
{ Y_Gamma_7, 0x60},
{ Y_Gamma_8, 0x80},
{ Y_Gamma_9, 0xa0},
{ Y_Gamma_10, 0xc0},
{ Y_Gamma_11, 0xe0},
{ Y_Gamma_12, 0xff},

//////////////////CC///////////////////
{ Reset_related, 0x00},
{ CC_Matrix_C11, 0x44},
{ CC_Matrix_C12, 0xfd},
{ CC_Matrix_C13, 0x02},//ordinary value 0x02
{ CC_Matrix_C21, 0xfa},//ordinary value 0x67
{ CC_Matrix_C22, 0x48},//ordinary value 0x67
{ CC_Matrix_C23, 0xf0},//ordinary value 0x00

//////////////// CROP /////////////////////////////
{ Crop_win_mode, 0x01},

////////////////////YCP////////////////////
{ Reset_related, 0x00},
{ Global_saturation, 0x40},
{ Global_Cb, 0x28},
{ Global_Cr, 0x28},
{ Global_contrast, 0x40},//cont 0x40
{ Luma_offset, 0x00},
{ Edge_mode, 0x14},
{ Auto_gray_mode, 0x34},

////////////////////AEC////////////////////
{ Reset_related, 0x01},
{ AEC_mode1, 0x40},// before Gamma
{ AEC_mode2, 0x91},//0x21
{ AEC_mode3, 0x07},// 13
{ AEC_target_Y_start, 0x50},//4
{ AEC_ignore, 0x88},//88, 08, c8, a8***a8
{ AEC_slow_margin, 0x21},//0x21
{ AEC_Istop_margin, 0x31},//AEC stop margin
{ AEC_max_pose_dg_gain, 0xb0},//0xc0
{ AEC_max_pre_dg_gain, 0x48},//0x60
{ GC_3c_p1, 0x95},//0x50
{ GC_3d_p1, 0x50},//0x40
{ GC_3e_p1, 0x48},//0x45

////////////////////AWB////////////////////
{ Reset_related, 0x01},
{ big_win_x0, 0x12},
{ big_win_y0, 0x06},
{ big_win_x1, 0x9c},
{ big_win_y1, 0xee},

{ AWB_RGB_high, 0xfc},
{ AWB_Y_to_C_diff2, 0x28},
{ AWB_Y_to_C_diff2_big, 0x10},
{ AWB_C_inter, 0x20},
{ AWB_C_inter2, 0x12},
{ AWB_C_max, 0x16},
{ AWB_C_max_big, 0x30},

{ AWB_number_limit, 0x60},
{ AWB_adjust_mode , 0x08},
{ Light_gain_range, 0x02},
{ move_number_limit, 0x63},
{ show_and_mode, 0x35},
{ adjust_speed, 0x72},
{ light_temp_mode, 0x11},
{ R_5k_gain, 0x40},
{ B_5k_gain, 0x40},
{ AWB_sinT, 0xc8},
{ AWB_cosT, 0xa0},
{ AWB_X1_cut, 0x40},
{ AWB_X2_cut, 0x50},
{ AWB_Y1_cut, 0x98},
{ AWB_Y2_cut, 0xfa},
{ AWB_R_gain_limit, 0x80},
{ AWB_G_gain_limit, 0x60},
{ AWB_B_gain_limit, 0x90},
{ AWB_small_win_width_step, 0x40},
{ AWB_small_win_height_step, 0x39},
{ AWB_C_inter_big, 0x30},
{ AWB_C_inter2_big, 0x60},
{ AWB_outdoor_mode, 0x41},

{ AWB_C_number_limit, 0x10},
{ AWB_C_weight_mode, 0x00},
{ AWB_RGB_low, 0x10},
{ AWB_uplow_luma_value, 0x40},

{ AWB_R_gain_out_h_limit, 0x60},
{ AWB_G_gain_out_H_limit, 0x50},
{ AWB_B_gain_out_H_limit, 0x42},
{ AWB_R_gain_out_I_limit, 0x40},
{ AWB_G_gain_out_I_limit, 0x40},
{ AWB_B_gain_out_I_limit, 0x40},

{ GC_74_p1, 0x40},
{ GC_75_p1, 0x58},
{ GC_76_p1, 0x24},
{ GC_77_p1, 0x40},
{ GC_78_p1, 0x20},
{ GC_79_p1, 0x60},
{ GC_7a_p1, 0x58},
{ GC_7b_p1, 0x20},
{ GC_7c_p1, 0x30},
{ GC_7d_p1, 0x35},
{ GC_7e_p1, 0x10},
{ AWB_CT_change_THD, 0x08},

///////////////////ABS(P1)///////////////////////
{ Y_S_comensate, 0x00},
{ Y_tilt, 0xc0},
{ Y_stretch_K, 0x40},

////////////////////CC-AWB(P1)////////////////////
{ GC_d0_p1, 0x00},
{ GC_d2_p1, 0x2c},
{ GC_d3_p1, 0x80},

/////////////////////////LSC/////////////////////////
{ Reset_related, 0x01},
{ LSC_up_red_b2, 0x0b},
{ LSC_up_green_b2, 0x07},
{ LSC_up_blue_b2, 0x05},
{ LSC_up_blue_b2, 0x0b},
{ LSC_down_green_b2, 0x07},
{ LSC_down_blue_b2 , 0x05},
{ LSC_down_green_b4, 0x39},//AEC exp level1
{ LSC_down_blue_b4, 0x24},
{ GC_bc_p1, 0x23},
{ LSC_right_red_b2, 0x39},
{ LSC_right_green_b2, 0x24},
{ LSC_right_blue_b2, 0x23},
{ LSC_up_red_b4, 0x00},
{ LSC_up_green_b4, 0x00},
{ LSC_up_blue_b4, 0x00},
{ LSC_down_red_b4, 0x00},
{ LSC_down_green_b4, 0x00},
{ LSC_down_blue_b4, 0x00},
{ LSC_left_red_b4, 0x2b},
{ LSC_left_green_b4, 0x00},
{ LSC_left_blue_b4, 0x00},
{ LSC_right_red_b4, 0x09},
{ LSC_right_green_b4, 0x00},
{ LSC_right_blue_b4, 0x00},
{ LSC_Q1_red_b1, 0x31},
{ LSC_Q1_green_b1, 0x23},
{ LSC_Q1_blue_b1, 0x20},
{ LSC_Q2_red_b1, 0x31},
{ LSC_Q2_green_b1, 0x23},
{ LSC_Q3_blue_b1, 0x20},
{ LSC_Q4_red_b1, 0x31},
{ LSC_Q4_green_b1, 0x23},
{ LSC_Q4_blue_b1, 0x20},
{ LSC_para_sign1, 0x00},
{ LSC_para_sign2, 0x00},
{ LSC_para_sign3, 0x00},
{ LSC_para_sign4, 0x00},
{ LSC_row_center, 0x30},
{ LSC_col_center, 0x50},
{ Reset_related, 0x00},

//////////////////// flicker ///////////////////

{ HB_high, 0x00},
{ HB_low, 0xff},
{ VB_high, 0x05},
{ VB_low, 0xc0},

{ Reset_related, 0x01},
{ AEC_anti_flicker_step_high, 0x00},
{ AEC_anti_flicker_step_low, 0x51},

{ AEC_exp_level_0_high, 0x01},
{ AEC_exp_level_0_low, 0x44},
{ AEC_exp_level_1_high, 0x01},
{ AEC_exp_level_1_low, 0xe6},
{ AEC_exp_level_2_high, 0x03},
{ AEC_exp_level_2_low, 0x7b},//89ms
{ AEC_exp_level_3_high, 0x0c},
{ AEC_exp_level_3_low, 0xa8},//324ms
{ AEC_MAX_EXP_LEVEL_AEC_EXP_MIN,0x20},
{ Reset_related, 0x00},

////////////////////out ///////////////////

{ Output_format, 0xa0},//YUV YcbYcr 0xa2
#ifdef SOFTWARE_SWITCH

{ switch_data_pad_en_mode, 0x00},
{ Analog_pwc, 0x17},
{ switch_data_output_en, 0x00},

#else
{ switch_data_pad_en_mode, 0x07},
{ switch_data_output_en, 0x01},
#endif
{THE_END,0x00},


};




设置输出格式 RAWRGB_DNDD_OUT:
static int set_pixformat(sensor_t *sensor, pixformat_t pixformat)
{
int ret=0;
// Read register COM7
ret = SCCB_Write(sensor->slv_addr , Reset_related, 0x00) ;

switch (pixformat) {
case PIXFORMAT_YUV422:
// ret = SCCB_Write(sensor->slv_addr , Output_format, 0xa0);
break;
case PIXFORMAT_RAWRGB_CISCTL_OUT:
ret=SCCB_Write(sensor->slv_addr , Block_enable_1, 0x00);
ret=SCCB_Write(sensor->slv_addr , Block_enable_2, 0x00);
ret=SCCB_Write(sensor->slv_addr , AAAA_enable, 0x00);
// ret=SCCB_Write(sensor->slv_addr , AEC_EN, 0x00);
ret=SCCB_Write(sensor->slv_addr , BYPASS_MODE, 0x04);
break;
case PIXFORMAT_RAWRGB_DNDD_OUT:
ret=SCCB_Write(sensor->slv_addr , Output_format, 0xb8);

// ret=SCCB_Write(sensor->slv_addr , Block_enable_1, 0x00);
// ret=SCCB_Write(sensor->slv_addr , Block_enable_2, 0x00);
// ret=SCCB_Write(se
...全文
1216 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_44097429 2018-12-14
  • 打赏
  • 举报
回复
不是CMOS问题?
曹大夯 2018-12-14
  • 打赏
  • 举报
回复
你的显示程序显示的时候可能不支持RAW Data,需要转化成显示程序支持的YUV或者RGB才能显示彩色图片吧?
勋锅的笔记 2018-11-13
  • 打赏
  • 举报
回复
请问怎么输出彩色图片呢?

21,615

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧