📄 ccdpp.cpp
字号:
/*
* Copyright 2008, writen by shikosan
* File name: ccdPP.cpp
* 零偏預處理
*/
#include "ccd.h"
#include "ccdPP.h"
#define SZ_ROW 64
#define SZ_COL 128
// change char into unsigned char by shikosan
// static char buffer[SZ_ROW][SZ_COL];
static unsigned char buffer[SZ_ROW][SZ_COL];
// change unsigned into signed
// static unsigned rowIndex, colIndex;
static int rowIndex, colIndex;
void CcdppInitialize()
{
rowIndex = -1;
colIndex = -1;
}
// This function performs zero-bias adjustment after each row read in
void CcdppCapture(void)
{
// Change char into uchar
// char bias;
unsigned char bias;
CcdCapture();
for(rowIndex=0; rowIndex<SZ_ROW; rowIndex++)
{
for(colIndex=0; colIndex<SZ_COL; colIndex++)
{
buffer[rowIndex][colIndex] = CcdPopPixel();
}
bias = (CcdPopPixel() + CcdPopPixel()) / 2;
for(colIndex=0; colIndex<SZ_COL; colIndex++)
{
buffer[rowIndex][colIndex] -= bias;
}
}
rowIndex = 0;
colIndex = 0;
}
// This function obtains image pixel
// Change char into uchar
// char CcdppPopPixel(void)
unsigned char CcdppPopPixel(void)
{
// Change char into uchar
// char pixel;
unsigned char pixel;
pixel = buffer[rowIndex][colIndex];
if( ++colIndex == SZ_COL )
{
colIndex = 0;
if( ++rowIndex == SZ_ROW )
{
colIndex = -1;
rowIndex = -1;
}
}
return pixel;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -