'*************************findcenter() subroutine******************** ' ' purpose: takes the data computed by sobel and the history array ' to find the center of an object ' ' input: SobelData array ' history array ' ' output: updated history array ' bestfine called to display best fit line ' linesegments called to draw the line segments between the ' history points ' '******************************************************************** Sub findcenter() Dim howmany As Integer For howmany = 0 To bfln - 1 Call centers(history(howmany, 0), history(howmany, 1), howmany) Next howmany Call linesegments Call bestfitline If bfln > 1 Then Dim mvmntforecast As Integer mvmntforecast = history(0, 1) - history(1, 1) 'top minus middle middiff.Caption = mvmntforecast '****this line is actually the visual representation of the forecast 'Picture4.ScaleMode = vbPixels 'Picture4.DrawWidth = 5 'Picture4.Line (history(1, 1), history(1, 0))-(history(1, 1) + mvmntforecast, history(1, 0) - 20), RGB(255, 255, 0) End If End Sub