資源簡介
圖像編碼學(xué)中有預(yù)測編碼、變換編碼以及混合編碼。KLT算法是圖像編碼算法中的一種。此為C語言開發(fā)的可公開使用的KLT工具

代碼片段和文件信息
/*********************************************************************
?*?convolve.c
?*********************************************************************/
/*?Standard?includes?*/
#include?
#include?
#include????/*?malloc()?realloc()?*/
/*?Our?includes?*/
#include?“base.h“
#include?“error.h“
#include?“convolve.h“
#include?“klt_util.h“???/*?printing?*/
#define?MAX_KERNEL_WIDTH? 71
typedef?struct??{
??int?width;
??float?data[MAX_KERNEL_WIDTH];
}??ConvolutionKernel;
/*?Kernels?*/
static?ConvolutionKernel?gauss_kernel;
static?ConvolutionKernel?gaussderiv_kernel;
static?float?sigma_last?=?-10.0;
/*********************************************************************
?*?_KLTToFloatImage
?*
?*?Given?a?pointer?to?image?data?(probably?unsigned?chars)?copy
?*?data?to?a?float?image.
?*/
void?_KLTToFloatImage(
??KLT_PixelType?*img
??int?ncols?int?nrows
??_KLT_FloatImage?floatimg)
{
??KLT_PixelType?*ptrend?=?img?+?ncols*nrows;
??float?*ptrout?=?floatimg->data;
??/*?Output?image?must?be?large?enough?to?hold?result?*/
??assert(floatimg->ncols?>=?ncols);
??assert(floatimg->nrows?>=?nrows);
??floatimg->ncols?=?ncols;
??floatimg->nrows?=?nrows;
??while?(img?}
/*********************************************************************
?*?_computeKernels
?*/
static?void?_computeKernels(
??float?sigma
??ConvolutionKernel?*gauss
??ConvolutionKernel?*gaussderiv)
{
??const?float?factor?=?0.01f;???/*?for?truncating?tail?*/
??int?i;
??assert(MAX_KERNEL_WIDTH?%?2?==?1);
??assert(sigma?>=?0.0);
??/*?Compute?kernels?and?automatically?determine?widths?*/
??{
????const?int?hw?=?MAX_KERNEL_WIDTH?/?2;
????float?max_gauss?=?1.0f?max_gaussderiv?=?(float)?(sigma*exp(-0.5f));
????/*?Compute?gauss?and?deriv?*/
????for?(i?=?-hw?;?i?<=?hw?;?i++)??{
??????gauss->data[i+hw]??????=?(float)?exp(-i*i?/?(2*sigma*sigma));
??????gaussderiv->data[i+hw]?=?-i?*?gauss->data[i+hw];
????}
????/*?Compute?widths?*/
????gauss->width?=?MAX_KERNEL_WIDTH;
????for?(i?=?-hw?;?fabs(gauss->data[i+hw]?/?max_gauss)??????????i++?gauss->width?-=?2);
????gaussderiv->width?=?MAX_KERNEL_WIDTH;
????for?(i?=?-hw?;?fabs(gaussderiv->data[i+hw]?/?max_gaussderiv)??????????i++?gaussderiv->width?-=?2);
????if?(gauss->width?==?MAX_KERNEL_WIDTH?||?
????????gaussderiv->width?==?MAX_KERNEL_WIDTH)
??????KLTError(“(_computeKernels)?MAX_KERNEL_WIDTH?%d?is?too?small?for?“
???????????????“a?sigma?of?%f“?MAX_KERNEL_WIDTH?sigma);
??}
??/*?Shift?if?width?less?than?MAX_KERNEL_WIDTH?*/
??for?(i?=?0?;?i?width?;?i++)
????gauss->data[i]?=?gauss->data[i+(MAX_KERNEL_WIDTH-gauss->width)/2];
??for?(i?=?0?;?i?width?;?i++)
????gaussderiv->data[i]?=?gaussderiv->data[i+(MAX_KERNEL_WIDTH-gaussderiv->width)/2];
??/*?Normalize?gauss?and?deriv?*/
??{
????const?int?hw?=?gaussderiv->width?/?2;
????float?den;
????den?=?0.0;
????for?(i?=?0?;?i?width?;?i++)??den?+=?gauss->data[i];
????for?(i?=?0?;?i?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2007-08-30?19:52??klt\
?????文件?????????694??2005-08-17?15:09??klt\ba
?????文件????????8204??2005-08-17?14:46??klt\convolve.c
?????文件?????????649??1998-10-07?16:15??klt\convolve.h
?????目錄???????????0??2007-08-30?19:52??klt\doc\
?????文件?????????182??1998-10-07?16:15??klt\doc\home_motif.gif
?????文件????????2896??2006-11-08?17:47??klt\doc\index.html
?????文件????????2100??2007-08-30?19:55??klt\doc\installation.html
?????文件????????9797??2007-08-30?19:59??klt\doc\log.html
?????文件?????????164??1998-10-07?16:15??klt\doc\next_motif.gif
?????文件?????????212??1998-10-07?16:15??klt\doc\previous_motif.gif
?????文件????????2317??2007-08-30?19:54??klt\doc\previous_versions.html
?????目錄???????????0??2007-08-30?19:52??klt\doc\ref\
?????文件????????1421??1998-10-07?16:15??klt\doc\ref\change_pyramid.html
?????文件?????????621??1998-10-07?16:15??klt\doc\ref\count.html
?????文件????????1680??1998-10-07?16:15??klt\doc\ref\create.html
?????文件????????1968??1998-10-07?16:15??klt\doc\ref\feature.html
?????文件????????1264??1998-10-07?16:15??klt\doc\ref\fh.html
?????文件????????1238??1998-10-07?16:15??klt\doc\ref\fl.html
?????文件????????1220??1998-10-07?16:15??klt\doc\ref\ft.html
?????文件????????1384??1998-10-07?16:15??klt\doc\ref\index.html
?????文件?????????561??1998-10-07?16:15??klt\doc\ref\print_tc.html
?????文件????????2264??1998-10-07?16:15??klt\doc\ref\replace.html
?????文件????????3368??1998-10-07?16:15??klt\doc\ref\select.html
?????文件????????1076??1998-10-07?16:15??klt\doc\ref\stop.html
?????文件????????1885??1998-10-07?16:15??klt\doc\ref\store.html
?????文件????????9511??2007-08-30?19:48??klt\doc\ref\tc.html
?????文件????????4109??1998-10-07?16:15??klt\doc\ref\track.html
?????文件?????????943??1998-10-07?16:15??klt\doc\ref\update_border.html
?????文件?????????674??1998-10-07?16:15??klt\doc\ref\verbosity.html
?????文件????????3064??2005-08-22?20:38??klt\doc\ref\write.html
............此處省略55個文件信息
評論
共有 條評論