Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341142
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:08:12

别人给了一小段程序,好象是C++写的,但是格式不对,不能运行,请帮忙改一下.谢谢了!

// First Calculate The PS of the front image// This script calculates the diffractogram of the topmost image. // A region with sides a power of two must be selected with the selection tool.// Procedure for calculation of diffractogram:// Step 1: subtract mean of selection of image.// Step 2: multiply selection with appropriately sized Hanning window.// Step 3: perform a Fourier transform.// Step 4: Display the log of the amplitude.// use script help for help on individual calculator commandsimage imgnumber top, left, bottom, rightif( !GetFrontImage(img) ){ OkDialog("You must have an image to operate on!") exit(0)}GetSelection(img,top,left,bottom,right) // uses whole image rectangle if no selection is presentnumber width = right - leftnumber height = bottom - topcompleximage FFTImage := RealFFT(img)number zoom = 512/widthif (zoom > 1) zoom = 1SetZoom(FFTImage,zoom)SetName(FFTImage, "FFT")KeepImage(FFTImage)image windowedImg := CreateFloatImage("",width,height)windowedImg = ( 1-cos(2*pi()*icol/width) ) * ( 1-cos(2*pi()*irow/height) ) * (img[]-average(img[]))compleximage diffractogram := RealFFT(windowedImg)deleteimage(windowedImg)image ps := modulus(diffractogram)SetName(ps, "Power Spectrum")deleteimage(diffractogram)SetZoom(ps,zoom)ShowImage(ps)

--------------------next---------------------

阅读(1402) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~