⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ccdpp.cpp

📁 用VC編的數碼相機仿真程序 包括圖像的預處理 DCT變換 壓縮等 最后可用verify.exe做比較
💻 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 + -