Thanks for the reply Steven. Processing speed is not an issue so far, the VB pipe extension method works just fine. If anyone is interested here's the VB6 code (written quick n dirty), just delete or rem out the existing code in the "Process" Sub and add this:
'^^^^^^^^^^^^^^^^^^begin paste^^^^^^^^^^^^^^^^^^^^
Dim xbegin As Long, ybegin As Long, yend As Long
Dim j As Long, i As Long, a As Long
Dim ycount As Long, xcount As Long, pixbegin As Long
Static imarray() As Long
Static framenum As Long
'******************user set parameters********************
'set to same size as webcam HxV resolution
Const xsizecam = 160 'H
Const ysizecam = 120 'V
'Region of Interest SubWindow HxV change size here, must be <= to cam HxV
Const xsize = 40 'H
Const ysize = 40 'V
'number of frames to store in array, change here must be <= # of picture boxes on PipeServer form
Const framestocapture = 30
'**********************************************************
'capture `framestocapture` #of frames
If framenum >= framestocapture Then
framenum = 0
''' Exit Sub
End If
framenum = framenum + 1
If framenum = 1 Then
ReDim imarray(1 To 60, 1 To xsize, 1 To ysize) 'framenum, H, V
End If
For a = 1 To framestocapture
With PipeServer.Picture1(a - 1)
.Width = (.Width / .ScaleWidth) * xsize
.Height = (.Height / .ScaleHeight) * ysize
End With
Next a
xbegin = (xsizecam / 2) - (xsize / 2)
ybegin = (ysizecam / 2) - (ysize / 2)
yend = ybegin + ysize
'copy frame to array
ycount = 1
For i = ybegin To yend - 1 'rows, V
xcount = 1
pixbegin = ((i * xsizecam * 3) + xbegin * 3) 'first pixel memory position
For j = pixbegin To pixbegin + ((xsize - 1) * 3) Step 3 'columns H
imarray(framenum, xcount, ycount) = imagePixels(j)
xcount = xcount + 1
Next j
ycount = ycount + 1
Next i
'copy image in position #n from imarray() to picture(n)
a = framenum
For i = 1 To ysize
For j = 1 To xsize
PipeServer.Picture1(a - 1).PSet (j, i), RGB(imarray(a, j, i), imarray(a, j, i), _
imarray(a, j, i))
Next j
Next i
'^^^^^^^^^^^^^^^end paste^^^^^^^^^^^^^^^^^^^^^^^
Next add this line below the Dim statements close to the top of the "Main" Sub:
'^^^^^^^^^^^^^^^^^^^^^begin paste^^^^^^^^^^^^^^
PipeServer.Show 'show form
'^^^^^^^^^^^^^^^^end paste^^^^^^^^^^^^^^^^^^^^^
Next add a picturebox control to the PipeServer form. Go to the picturebox's property window and set ScaleMode to "Pixels" Then
copy the pictuerebox and paste it ("Yes" when asked if you want to create a control array) until you have 30 picture boxes on the form.
RoboRealm is powerful and easy to work with, a fine piece of work, complments to the author(s)!
Cheers,
Mario
|
|