redflag 发表于 2003-8-12 17:40:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

<P>!*****************************************************************************
! Sequence:   RELI.SEQ
!
! Purpose:      Macro to plot Relative illumination vs. Fileds
!               
! Syntax:       in RELI
!
!
! Notes:      This macro uses and overwrites buffer B0.
!
! Author:       Doffey          Date: 2003-07-15
!
! History:      2003-07-15
!               
!*****************************************************************************</P>
<P>lcl num ^numfld ^i ^j
lcl num ^fld(25) ^reli(25)
lcl str ^dim
lcl num ^maxfld
ver n</P>
<P>out n
^numfld == (num f)</P>
<P>!if (typ fld)="ANG"
!^maxfld == (yan f^numfld)
!else if (typ fld)="OBJ"
   ^maxfld == (yob f^numfld)
!else if (typ fld)="IMG"
   ^maxfld == (yim f^numfld)
!else if (typ fld)="RIH"
!^maxfld == (yri f^numfld)
!else
!^maxfld == 0
!end if</P>
<P>!^f=='f'</P>
<P>!save</P>
<P>!del fa
!for ^i 1 20
!ins f^i+1
!^f==concat(^f,num_to_str(^i+1))
!in cv_macrcvsetfield Y ^i*^maxfld/20 $f
!^f=='f'
!end for</P>
<P>^numfld == (num f)
for ^i 1 ^numfld
    if (typ fld)="ANG"
      ^fld(^i) == (yan f^i)
    else if (typ fld)="OBJ"
      ^fld(^i) == (yob f^i)
    else if (typ fld)="IMG"
      ^fld(^i) == (yim f^i)
    else if (typ fld)="RIH"
      ^fld(^i) == (yri f^i)
    else
      ^fld(^i) == 0
    end if
end for
out n
BUF DEL B0 ! clear B0 buffer
BUF YES    ! turn on output buffer to collect output
tra
go
BUF NO   ! turn off output buffer</P>
<P>    </P>
<P>BUF FND "RELATIVE ILLUM:"            ! find first occurrence</P>
<P>for ^i 1 ^numfld
   for ^j 1 (num w)
   buf mov ic jc+1
   end for
   if not ((buf.typ ic jc+1) = "NUM")
   got ER
   end if
^reli(^i) == (buf.num ic jc+1)/100 ! ic updated by each BUF FND
BUF FND                              ! find next occurrence
end for
out y
wri "Calculating the Relative Illumniation..."
wri
wri "FieldRelative Illumination"
for ^i 1 ^numfld
wri Q"'dd.ddd'    'dd.ddd'" ^fld(^i) ^reli(^i)
end for
out n</P>
<P>! plot the MTF vs Field curves using UGR
ugr</P>
<P>tit substr((tit),1,40)
if (dim)="I"
    ^dim == " (inches)"
else if (dim)="M"
    ^dim == " (mm)"
else if (dim)="C"
    ^dim == " (cm)"
else
    ^dim == ""
end if
if (typ fld)="ANG"
    xla "FIELD ANGLE"
else if (typ fld)="OBJ"
    xla concat("OBJECT HEIGHT",^dim)
else if (typ fld)="IMG"
    xla concat("IMAGE HEIGHT",^dim)
else if (typ fld)="RIH"
    xla concat("REAL IMAGE HEIGHT",^dim)
else
end if
yla "RELATIVE ILLUMINATION"
xax 0   ! x and y cross at zero
xde grd (^fld(^numfld))/10
yax 0
ymi 0   ! MTF range 0-1 by 0.1
yma 1.0
yde grd 0.1
yfo f 1   ! number formats for labels
xfo f 2
! create data point sets
dpo 'Relative Illumination'
spl 1 blu
for ^i 1 ^numfld
^fld(^i) ^reli(^i)
end for
end
go
GOT END</P>
<P>wri
lbl ER
out y
wri "ERROR: buffer error,Please check your lens!"
out n
lbl END
!res
ver y
OUT YES
</P>
[此贴子已经被作者于2004-5-22 7:44:46编辑过]

redflag 发表于 2003-8-12 17:56:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

此宏的屏幕图形

robin 发表于 2003-8-13 16:19:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示



在MTF计算中不是有各个视场的相对亮度输出吗?含余玄四次方和渐晕系数的因素,但不计入透射和反射损失。你的宏有必要吗?取得五个视场得数据后就可以使用codev的macro作出图来。



redflag 发表于 2003-8-14 01:19:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

这个宏是利用TRA算出来的。比MTF里面的计算要准确一些。
这里取了二十个视场点,目的是使曲线显示的更准确一些。
我的第一个版本是使用了UGR,不太美观,所以改成现在的样子。
上一次的宏会出现失败时有多个视场被设定,这个版本改进了。
谢谢你的宝贵意见,但仅供参考。

robin 发表于 2003-8-14 16:47:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示



不客气。你的干劲比我大。我怕写宏。



ariston0088 发表于 2003-9-15 21:42:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示



thanks!



zengshenbo 发表于 2003-10-18 00:36:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示



好东西,收下了



lidy 发表于 2003-10-27 20:46:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示



怎么用不了?



huanglin 发表于 2003-10-27 21:13:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

是你不会用!

lidy 发表于 2003-10-30 20:05:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

变焦曲线的宏可以用,为什么这个宏用不了,我是新手请指教,谢谢!!!

redflag 发表于 2003-10-31 15:39:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

请将错误报告贴出来

lidy 发表于 2003-10-31 20:51:00

[分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示

我将次宏取名为:PRJ.SEQ
错误报告如下:12:42:04 Command Issued: IN PRJ - Warning: Sequence aborted
12:42:15 Command Issued: IN PRJ - Error: Definitions are only allowed before any executable statement
12:42:15 Command Issued: IN PRJ - Error: Statement terminator expected, but not found
12:42:15 Command Issued: IN PRJ - Error: ELSE control statement is invalid at this point
12:42:15 Command Issued: IN PRJ - Error: Variable (^NUMFLD) has never been assigned a value
12:42:15 Command Issued: IN PRJ - Error: Undefined variable encountered within expression
12:42:15 Command Issued: IN PRJ - Error: Only scalar variables may be typed implicitly
12:42:16 Command Issued: IN PRJ - Warning: **** COMPILATION ERRORS - SEQUENCE NOT EXECUTED ****
12:42:16 Command Issued: IN PRJ - Warning: Sequence aborted
页: [1] 2
查看完整版本: [分享]新版相对亮度曲线,修正了几个BUG,改进了图形显示