新增3通道校正,调整0A 寄存器

This commit is contained in:
modehua 2023-10-30 00:56:55 -07:00
parent e4614bd436
commit 7288701891
3 changed files with 34 additions and 10 deletions

View File

@ -74,10 +74,10 @@ union CamZ_Reg_A_New
unsigned int stop : 1; //下降沿触发 unsigned int stop : 1; //下降沿触发
unsigned int unuse_0 : 5; unsigned int unuse_0 : 5;
unsigned int finished : 1; //finished unsigned int finished : 1; //finished
unsigned int psen: 1; //使能相移 写低写高 unsigned int psen: 1; //使能相移 写低写高
unsigned int psincdec : 1; //相移动反向 unsigned int psincdec : 1; //相移动反向
unsigned int clr_psedon : 1;//清除相完成 写低写高 unsigned int clr_psedon : 1;//清除相完成 写低写高
unsigned int dpi: 2; //1: 300DPI 0: 600DPI unsigned int dpi: 2;//bit 12 //1: 300DPI 0: 600DPI
unsigned int dpi_200: 1; //dpi=1的时候 dpi_200=1 200dpi dpi=1的时候 dpi_200=0 300dpi dpi=0的时候 dpi_200=0 600dpi unsigned int dpi_200: 1; //dpi=1的时候 dpi_200=1 200dpi dpi=1的时候 dpi_200=0 300dpi dpi=0的时候 dpi_200=0 600dpi
}; };
}; };

View File

@ -16,7 +16,7 @@
const int vsp_A = 45; const int vsp_A = 45;
const int vsp_B = 45; const int vsp_B = 45;
#define ARRAYLEN(table) (sizeof(table) / sizeof(table[0]))
// using namespace cv; // using namespace cv;
MultiFrameCapture::MultiFrameCapture(ScannerGlue glue) : MultiFrameCapture::MultiFrameCapture(ScannerGlue glue) :
snaped_index(0), snaped_index(0),
@ -553,15 +553,20 @@ void MultiFrameCapture::procimage()
} }
} }
static int temp_val = 0; static int temp_val = 0;
#define CIS_6CH
bool MultiFrameCapture::saveLutImg(int dpi, int mode, bool black) bool MultiFrameCapture::saveLutImg(int dpi, int mode, bool black)
{ {
printf("校正DPI[%d] 校正颜色:%s\n",dpi==1?200:(dpi==2?300:600),mode == IMAGE_COLOR?"彩色":"灰色"); printf("校正DPI[%d] 校正颜色:%s\n",dpi==1?200:(dpi==2?300:600),mode == IMAGE_COLOR?"彩色":"灰色");
int config_dpi = dpi ; int config_dpi = dpi ;
#ifdef CIS_6CH
const int offset_indexs[] = {3, 4, 5, 2, 1, 0 ,0, 1, 2, 5, 4, 3}; const int offset_indexs[] = {3, 4, 5, 2, 1, 0 ,0, 1, 2, 5, 4, 3};
#else
const int offset_indexs[] = {2, 1, 0, 0, 1 ,2};
#endif
int channels = mode == IMAGE_COLOR ? 3 : 1; int channels = mode == IMAGE_COLOR ? 3 : 1;
int height = 60; int height = 60;
int width = config_dpi == 0x02 ? 864 : (config_dpi == 0x03 ? 1728 : 576); int width = config_dpi == 0x02 ? 864 : (config_dpi == 0x03 ? 1728 : 576);
int orgimgwidth = width * 2 * 3 * channels; int orgimgwidth = width * 2 * 3 * channels;
printf("orgimgwidth:%d\r\n",orgimgwidth); printf("orgimgwidth:%d\r\n",orgimgwidth);
@ -602,9 +607,16 @@ bool MultiFrameCapture::saveLutImg(int dpi, int mode, bool black)
FPGAConfigParam param = GetFpgaparam(dpi, mode); FPGAConfigParam param = GetFpgaparam(dpi, mode);
if (black) // 暗场 if (black) // 暗场
{ {
#ifdef CIS_6CH
volatile double offValues[12]{0}; volatile double offValues[12]{0};
double offValues_min[12]{0}; double offValues_min[12]{0};
int blockcount = 12; int blockcount = 12;
#else
volatile double offValues[6]{0};
double offValues_min[6]{0};
int blockcount = 6;
#endif
int bandwidth = mrgmat.cols / blockcount; int bandwidth = mrgmat.cols / blockcount;
for (int n = 0; n < blockcount; n++) for (int n = 0; n < blockcount; n++)
{ {
@ -632,7 +644,8 @@ bool MultiFrameCapture::saveLutImg(int dpi, int mode, bool black)
{ {
unsigned int offsets[6]; // = (int *)(s == 0 ? &param.OffsetF[0] : &param.OffsetB[0]); unsigned int offsets[6]; // = (int *)(s == 0 ? &param.OffsetF[0] : &param.OffsetB[0]);
memcpy(offsets, (s == 0 ? &param.OffsetF[0] : &param.OffsetB[0]), sizeof(param.OffsetF)); memcpy(offsets, (s == 0 ? &param.OffsetF[0] : &param.OffsetB[0]), sizeof(param.OffsetF));
for (int j = 0; j < 6; j++) int total_chs = ARRAYLEN(offset_indexs);
for (int j = 0; j < total_chs/2; j++)
{ {
int k = s * 6 + j; int k = s * 6 + j;
// double diff = BLACK_DIFF(offValues[k]); // double diff = BLACK_DIFF(offValues[k]);

View File

@ -11,6 +11,17 @@ using namespace std;
* G400/G300 * * G400/G300 *
******************************************/ ******************************************/
#define G300 #define G300
//#define CIS_6CH
#define CIS_3CH
#ifdef CIS_6CH
#undef CIS_3CH
#elif define CIS_3CH
#undef CIS_6CHC
#else
#endif
/****************************************** /******************************************
* SPEEDMODE==3 60PPM * * SPEEDMODE==3 60PPM *
* SPEEDMODE==4 70PPM * * SPEEDMODE==4 70PPM *
@ -51,11 +62,11 @@ typedef struct
static std::map<int , sp_COLOR_or_GRAY>mapFradme_SP={ static std::map<int , sp_COLOR_or_GRAY>mapFradme_SP={
{1,{0x08ED1003,0x1ACC1002,CON(G340,230429)}},//40 ppm {1,{0x08ED1003,0x1ACC1002,CON(G34D,231027)}},//40 ppm
{2,{0x06DB1003,0x14A01002,CON(G350,230429)}},//50 ppm {2,{0x06DB1003,0x14A01002,CON(G35D,231027)}},//50 ppm
{3,{0x05591003,0x100E1002,CON(G360,230429)}},//60 ppm {3,{0x05591003,0x100E1002,CON(G36D,231027)}},//60 ppm
{4,{0x04421003,0x0CD11002,CON(G370,230429)}},//70 ppm {4,{0x04421003,0x0CD11002,CON(G37D,231027)}},//70 ppm
{5,{0x036c1003,0x0A421002,CON(G380,230429)}},//80 ppm {5,{0x036c1003,0x0A421002,CON(G38D,231027)}},//80 ppm
}; };
enum class LedStatus enum class LedStatus