各位前輩好,以下是小弟在NI-IMAQ for IEEE-1394資料夾裏找到的程式,
稍微測試了一下它的功能,似乎能將拍攝到的影像,做光強度訊號的長條圖分佈,
但現再我的疑問是不確定長條圖的縱軸是不是真的代表光的intensity,
以及其縱軸和橫軸的單位又分別為何?
以下是本程式的code:
Option Explicit
Dim ImageArray As Variant
Dim HistogramReport As New CWIMAQHistogramReport
Dim sid As SESSION_ID
Dim errorCode As IMG_ERR
Dim myImage As New CWIMAQImage
Private Sub Form_Load()
CWIMAQViewer1.Attach myImage
End Sub
Private Sub Snap_Click()
errorCode = imaq1394CameraOpen(IntfName.Text, sid)
If (errorCode <> IMG1394_ERR_GOOD) Then
GoTo Error
End If
errorCode = imaq1394SnapCW(sid, myImage)
If (errorCode <> IMG1394_ERR_GOOD) Then
GoTo Error
End If
'Compute the histogram using the CWImaqVision object and
'display it in a Component Works graph (evaluation version)
If myImage.Type <> cwimaqImageTypeRGB32 Then
CWIMAQVision1.Histogram2 myImage, HistogramReport
Else
CWIMAQVision1.ColorHistogram2 myImage, cwimaqColorFormatRGB, , HistogramReport
End If
CWGraph1.PlotY HistogramReport(1).Histogram
Error:
If (errorCode <> IMG1394_ERR_GOOD) Then
Dim errorMessage As String
Call imaq1394ShowErrorCW(errorCode, errorMessage)
MsgBox errorMessage
End If
Call imaq1394Close(sid)
End Sub
Private Sub Quit_Click()
End
End Sub
已解決! 轉到解決方案。
在 12-18-2008 08:30 AM
您好,我的建議是:
請將您所分析的圖檔及該影像分析結果(report:*.txt?)附上來,讓我們幫你看一下其所代表意義。
橫軸有可能是您圖檔的X方向的總像素(若是640*480的圖檔,則請您看一下橫軸刻度是否是到640)。
縱軸有可能是影像 X_i 位置的總亮度(若是640*480的圖檔,則是(X_i,0)到(X_i,480)的亮度總和)。
供您參考。
在 12-19-2008 12:45 AM
您好,
由您所附的檔案:
橫軸代表Intensity(0~255)(Grayscale)
縱軸代表該Intensity數值的像素總數目.
但由您附檔的左圖看到,原圖應該為RGB格式,所以很可能由CWImaqVision將原圖轉為Intensity Plane之後才進行分析.
在這裏附上一個連結供您參考.