Page 1 of 1

VIDEOCAPX

Posted: Sat Jul 11, 2015 3:10 am
by unixkd
Hi Roger,

I will like to use the VideoCapX for photo capture for our Personnel/ID card project. When I run your Videecapx sample, I get "Preview fail" error. If I comment out the oVideo1:Preview := .t., the error disapper, but the viewing window not displayed.

Thanks.

Joe

Re: VIDEOCAPX

Posted: Sat Jul 11, 2015 6:00 am
by rdonnay
How many cameras do you have?

You may want to try with only 1 camera.

Comment out anything with video2.

Re: VIDEOCAPX

Posted: Sat Jul 11, 2015 7:44 am
by Auge_Ohr
unixkd wrote:I will like to use the VideoCapX for photo capture for our Personnel/ID card project.
you do not need a ActiveX for just get a Picture ...

search at http://www.xbwin.com -> Newsforum for
How to call these functions is Xbase++
ot4xb.public
27. April 2012

Who can help ?
ot4xb.public
28. April 2012
you will find xbpWebCam.zip ( use Pablos Version )

Re: VIDEOCAPX

Posted: Thu Jul 30, 2015 6:34 am
by unixkd
Hi All

Videocapx is working well. All the problem I encountered were due to the windows driver I was using with my webcam. When I downloaded the LOGITECH native driver for my webcam, all the problems dissapered.

To capture live photo in your application using VIDEOCAPX somebody already wrote a function way back 2010 and shared it in Alaska newsgroup. see below:

*********************************************************************
Function Get_Photo(oFrame, cCustomer_Picture, oDlg_Passed)
*********************************************************************
LOCAL cText, oMle, aFormats, aMess
LOCAL oBMP, oPS,cString, n, oClipBoard, nStatus, cdefsourec, lClipboard:=.f., nresult, aWin_Size, lExit:=.f., lQuit:=.f., lFail:=.f.
Local nEvent := Nil, mp1 := NIL, mp2 := NIL, oXbp
Local oDlg, aPos[2], aSize[2], oDraw, oVideo
LOCAL bError := ErrorBlock( {|e| Break(e) } )
LOCAL oError
aWin_Size := AppDeskTop():currentSize()
lClipboard:=.f.
*******************************************
* Open Clipboard and get available formats
*******************************************
oClipBoard := XbpClipBoard():new():create()
oClipBoard:open()
aFormats := oClipBoard:queryFormats()

******************************************
* Scan for a bit map in the clipboard
******************************************

IF AScan( aFormats, XBPCLPBRD_BITMAP ) > 0
**********************************************
* Get bitmap object from clipboard if detected
**********************************************

oBmp := oClipBoard:getBuffer( XBPCLPBRD_BITMAP)



* Delete existing customer photo
FErase( cCustomer_Picture)

* Save new customer photo
oBMP:SaveFile(cCustomer_Picture, XBPBMP_FORMAT_JPG)
oBMP:Destroy()
oFrame:unload()
oFrame:loadfile(cCustomer_Picture)
oFrame:draw()
lClipboard:=.t.
ELSE
* no bitmap detected
ENDIF

* close clipboard
oClipBoard:clear()
oClipBoard:Close()
oClipBoard:Destroy()

If !lClipboard

*****************************************************
* Following is the direct drive way of getting to camera
*****************************************************

aSize[1] := 350
aSize[2] := 330
aPos[1] := (aWin_Size[1]/2) - (aSize[1]/2)
aPos[2] := (aWin_Size[2]/2) - (aSize[2]/2)

oDlg := XbpDialog():new(AppDeskTop(),oDlg_Passed , aPos, aSize )
oDlg:title := "Take Customer Picture"
oDlg:taskList := .T.
oDlg:close := {|| lExit:=.t. }
oDlg:create()
oDlg:drawingArea:setFontCompoundName( FONT_HELV_SMALL )
oDraw:=oDlg:drawingArea
// SetAppWindow( oDlg )

/*
* Create pushbuttons in the application window
*/
oXbp := XbpPushbutton():new( oDlg, , {62,12}, {100,30} )
oXbp:caption := "Snap Picture"
oXbp:activate := {||oVideo:SaveFrameJPG(cCustomer_Picture,75),Sleep(10),lExit:=.t.}
oXbp:create()


oXbp := XbpPushbutton():new(oDlg , , {186,12}, {100,30} )
oXbp:caption := "Quit"
oXbp:activate := {|| lQuit:=.t., lExit:=.t. }
oXbp:create()

/*
* Create Video Activex control
*/
BEGIN SEQUENCE
oVideo:=XbpActiveXControl():new( oDraw, , {12,50}, {320,240})
oVideo:CLSID := "VIDEOCAPX.VideoCapXCtrl.1"
// oVideo:License:="Your license goes here... if evaluation do not use this line"
oVideo : create()
Sleep(10)
// oVideo:UseVideoFilter:=0 && no picture is captured into file if this is set to 0
oVideo:AudioDeviceIndex:=-1 && Indicates no audio device is to be used
oVideo:CaptureAudio:=.f. && sets the audio capture off
// oVideo:DebugMode:=1 && for debugging purposes only....take out when finished
oVideo:SetVideoFormat(320, 240)
oVideo:connected:=.t.
oVideo:Preview:= .t.
RECOVER USING oError
msgbox("error detected...no camera or activex control")
lQuit:=.t.
lExit:=.t.
lFail:=.t.
ENDSEQUENCE
ErrorBlock( bError ) // reset error code block

SetAppFocus( oDlg )
DO WHILE !lExit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
If !lFail
oVideo:connected:=.f.
sleep(10)
oVideo:destroy()
Endif
oDlg:destroy()

oVideo:=nil
oDlg:=nil

If !lQuit
oFrame:unload()
oFrame:loadfile(cCustomer_Picture)
oFrame:draw()
Endif

Endif

Return nil

Re: VIDEOCAPX

Posted: Thu Jul 30, 2015 7:07 am
by rdonnay
you will find xbpWebCam.zip ( use Pablos Version )
I could not find that file.

Re: VIDEOCAPX

Posted: Thu Jul 30, 2015 9:27 am
by Auge_Ohr
hi,
rdonnay wrote:
you will find xbpWebCam.zip ( use Pablos Version )
I could not find that file.
you will find it in "Forum" not in "Download"
How to call these functions is Xbase++
ot4xb.public
27. April 2012

Who can help ?
ot4xb.public
28. April 2012
while it is 2012 you will find it on Page 17 of ot4xb.public