显示现场视频: 标记过度曝光和曝光不足的像素-2

这个示例程序演示的是如何通过编程,控制标记像素时所需的各个参数。
语言:Visual Basic 6
版本:3.0.3
发布于:2006年8月20日
作者:IC Imaging Control 技术支持部
系统要求:IC Imaging Control 3.0 或更高版本
由WDM数据流类驱动程序驱动的相机、视频转换器或图像采集卡

下面的示例程序 (Visual Basic™6) 对上一节介绍的程序进一步做了扩展, 它将演示如何直接在程序中,而不是通过滤镜的内置对话框,调节标记过度曝光或曝光不足的像素时的各个参数。

程序窗口如图所示:

The Testdialog of IC Imaging Control,

首先在Form1中声明一个FrameFilter 型的变量filter。 这个变量含有帧滤镜,用于与之交换数据。

Dim filter As FrameFilter 'This variable will hold the Clipping filter

滤镜提供了下列参数:阈值("Threshold"),参数"ClipAboveThreshold",标记像素时的色彩和模式("FillMode" und "FillColor")。 阈值可通过一个 scrollbar sldThreshold 控制。一个像素是否被标记通过两个radio button rbClipAbove 和 rbClipBelow 控制。 程序开始后首先调用两个在主窗体中初始化控件的函数。

InitControls
UpdateControls

函数 InitControls 初始化 scrollbar sldThreshold 的最小值与最大值。

Private Sub InitControls()
    sldThreshold.Min = 0
    sldThreshold.Max = 255
End Sub

函数 UpdateControls 将滤镜的参数 "Enable"、"Threshold" 及 "ClipAboveThreshold" 赋予 复选框 cbEnable、scrollbar sldThreshold 及 radio buttons rbClipAbove und rbClipBelow。

Private Sub UpdateControls()
    ' Update the "Enable" checkbox.
    If filter.Parameter("Enable") Then
        cbEnable.Value = Checked
    Else
        cbEnable.Value = Unchecked
    End If

    ' Update the radio buttons.
    If filter.Parameter("ClipAboveThreshold") Then
        rbClipAbove.Value = True
        rbClipBelow.Value = False
    Else
        rbClipAbove.Value = False
        rbClipBelow.Value = True
    End If

    ' Update the slider.
    sldThreshold.Value = filter.Parameter("Threshold")
    txThreshold.Text = sldThreshold.Value
End Sub

sldThreshold的事件处理程序将其当前值赋予滤镜的参数 "Threshold",并使用这个值更新显示文字 txThreshol。

Private Sub sldThreshold_Scroll()
    filter.Parameter("Threshold") = sldThreshold.Value
    txThreshold.Text = sldThreshold.Value
End Sub

Radio button rbClipAbove 的事件处理程序将True值赋予滤镜参数"ClipAboveThreshold", 反选 radio button rbClipBelow。rbClipBelow 的事件处理程序工作原理相同。

Private Sub rbClipAbove_Click()
    filter.BeginParameterTransfer
    filter.Parameter("ClipAboveThreshold") = True
    filter.EndParameterTransfer
    rbClipBelow.Value = False
End Sub

相关源代码示例

责任声明
IC Imaging Control 源代码库中的所有代码均只用于教学目的,The Imaging Source Europe GmbH 作为IC Imaging Control的开发制造商,不对任何由于使用本文或其中源代码所产生的后果承担责任。

该网站为The Imaging Source网络的一部分。其它的站点包括 公司, Imaging, 天文相机, Astronomy Cameras Blog, Blog caméras d'astronomie, 天文相机有奖竞答, TX Text Control, LiveDocx, phpLiveDocxForum.