Home Image-Pro Plus Automation with Macros

Retrieve milliseconds from framedate

(Originally posted by heerikhuize on 3/16/2006)

When a time sequence is collected and saved, then every frame has its own frametime. With the function IpDocGetPropDate the frame date can be retrieved. With the ipbasic function format things like hours minutes and seconds can be extracted. However not the last part : the millisecond can not be extracted. Is there a way to get the milliseconds information?



  • (Originally posted by JohnS on 3/28/2006)

    The milliseconds information is included in the DATE information that is returned by the Auto-Pro function that you are using. What are sadly missing are formatting functions for displaying the more accurate time information.

    The following code calculates the difference between first frame of a sequence and all the subsequent frames. The time difference is expressed in seconds. Note: This macro requires the Charting features of Image-Pro Plus 6.0.

    Sub plotTimes2()
    Dim dtRef As Date
    Dim dt2 As Date
    ret = IpDocGetPropDate(DOCSEL_ACTIVE, DOCPROP_TIME, 0, dtRef)
    Dim lCnt As Long
    ret = IpSeqGet(SEQ_NUMFRAMES, lCnt)
    Dim i As Long
    ReDim dfDiff(lCnt) As Double
    For i = 1 To lCnt - 1
    ret = IpDocGetPropDate(DOCSEL_ACTIVE, DOCPROP_TIME, i, dt2)
    dfDiff(i - 1) = (CDbl(dt2) - CDbl(dtRef)) * (24 * 60 * 60) ' express time difference in seconds
    Next i
    Dim lChart As Long
    lChart = IpChrt2DCreate("Capture Timing", CHRT_TYPE_HIST)
    If lChart < 0 Then
    Exit Sub
    End If
    ret = IpChrt2DSet(lChart, CHRT_NUM_GRAPHS, 1, 1.0)
    ret = IpChrt2DSetStr(lChart, CHRT_GRAPH_NAME, 0, "Capture Timing")
    ret = IpChrt2DSetStr(lChart, CHRT_X_NAME, 0, "Time of frame, in seconds")
    ret = IpChrt2DSetArr(lChart, CHRT_ARR_DOUBLE, 0, lCnt - 1, dfDiff(0))
    ret=IpChrt2DShow(lChart, 1)
    End Sub



Sign In or Register to comment.