没有合适的资源?快使用搜索试试~ 我知道了~
首页ISO12233中的MTF测试程序
ISO12233中的MTF测试程序

ISO12233中的MTF测试程序,C语言,实现的就是ISO中的算法。与算法无关部分没有显示。
资源详情
资源评论
资源推荐

/
*********************************************************************
********/
// sfr_computation.c
// Copyright (c) PIMA 1998 All Rights Reserved.
//
// Requests for permission to duplicate, distribute, publish, or otherwise copy this
code should be directed to PIMA
/
*********************************************************************
********/
#include "plugin.h"
#include "sfr_computation.h"
#include "io_routines.h"
#include "UserInterface.h"
#include "radiometric_transform.h"
/
*********************************************************************
********/
// macros
static double dmaxarg1,dmaxarg2;
#define DMAX(a,b) (dmaxarg1=(a),dmaxarg2=(b),(dmaxarg1) > (dmaxarg2) ?\
(dmaxarg1): (dmaxarg2))
static double dminarg1,dminarg2;
#define DMIN(a,b) (dminarg1=(a),dminarg2=(b),(dminarg1) < (dminarg2) ?\
(dminarg1): (dminarg2))
static double sqrarg;
#define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0: sqrarg*sqrarg)
/
*********************************************************************
********/
short sfrProc ( GHdl globals, dblHandle FreqHdl, dblHandle dispString)
{
unsigned short i, j, nSamplesPerPixel, tmpalpha, err = 0;
long pcnt, pcnt2, col, ww_in_pixels;
double dt, dt1, sfrc, tmp, tmp2, slope;
OSErr erro=0;
unsigned long size_x, size_y;
uHandle area=nil;
dblHandle darea=nil,temp=nil,shifts=nil,edgex=nil,Signal=nil;
dblHandle AveEdge=nil,AveTmp=nil,farea=nil;
longHandle counts=nil;
size_x = gStuff->inRect.right - gStuff->inRect.left;
size_y = gStuff->inRect.bottom - gStuff->inRect.top;

nSamplesPerPixel = gStuff->imageMode;
ww_in_pixels = size_x;
// Verify input selection dimensions are EVEN
if (fmod((double)size_x,2.0) != 0.00)
{
ShowAlertText(SHOWALERTSTOP,SFRERR,5);
gResult = 1;
return 1;
}
if (fmod((double)size_y,2.0) != 0.00)
{
ShowAlertText(SHOWALERTSTOP,SFRERR,6);
gResult = 1;
return 1;
}
// Allocate memory
//This code not shown
// Load the image data into the "area" array.
if (TestAbort ())
{
gResult = 1;
return 1;
}
err = load_area_array(globals, area);
if (err != 0)
{
gResult = 1;
return 1;
}
if (TestAbort ())
{
gResult = 1;
return 1;
}
err = radiometric_conversion(globals, area, darea);
if (err != 0)
{
gResult = 1;
return 1;
}
// Extract first color channel (luminance)

for (j=0;j < size_y;j++)
{
for (i=0;i < size_x;i++)
{
(*farea)[((j*(long)size_x)+i)] =
( *darea)[(nSamplesPerPixel*((j*(long)size_x)+i)) + 0L];
}
}
err = check_image_data( globals, farea, darea);
if (err != 0)
{
gResult = 1;
return 1;
}
if (TestAbort ())
{
gResult = 1;
return 1;
}
err = locate_centroids( globals, farea, temp, shifts);
if (err != 0)
{
gResult = 1;
return 1;
}
// Calculate the best fit line to the centroids
err = fit(size_y, temp, shifts, &slope);
if (err != 0)
{
gResult = 1;
return 1;
}
if ( fabs(slope) < (1.0/(double)size_y) || slope > (double)(1.0/4.0))
{
ShowAlertText(SHOWALERTSTOP,SFRERR,4);
gResult = 1;
return 1;
}
/
*********************************************************************
********/
剩余14页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论9