Capturing Image from Webcam - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Capturing Image from Webcam

darthmoobeydarthmoobey Posts: 140Member
Hello,

I'm trying to write a program, to keep track of employee data. I wish to include a webcam video stream, so when they are entering the employee name and information, they can take a webcam Snapshot and save the employee pic as a jpg, or gif in the database. I was hoping someone could have some information on the best place to try and find resource or code snippet on the best method to do this. I also am not sure if Microsoft Access has the ability to store picture data, like MySQL can. Would it be best for me to use MSDE2000 from microsoft, or will using Microsoft Access be ok for storing the picture data.

I managed to find some information on ezVidCap Control. Though I am not sure if it will allow me to save as jpg and or gif into the database using ADO connection strings.

Thank you anyone that can help.

The Darthmoob

Comments

  • darthmoobeydarthmoobey Posts: 140Member
    [b][red]This message was edited by darthmoobey at 2005-5-11 11:57:49[/red][/b][hr]
    : Hello,
    :
    : I'm trying to write a program, to keep track of employee data. I wish to include a webcam video stream, so when they are entering the employee name and information, they can take a webcam Snapshot and save the employee pic as a jpg, or gif in the database. I was hoping someone could have some information on the best place to try and find resource or code snippet on the best method to do this. I also am not sure if Microsoft Access has the ability to store picture data, like MySQL can. Would it be best for me to use MSDE2000 from microsoft, or will using Microsoft Access be ok for storing the picture data.
    :
    : I managed to find some information on ezVidCap Control. Though I am not sure if it will allow me to save as jpg and or gif into the database using ADO connection strings.
    :
    : Thank you anyone that can help.
    :
    : The Darthmoob
    :

    Okay... I have managed to work with this program, to capture a single Bitmap, and save it to the hard drive. I was wondering what would be the easiest method, to instead send it to the Microsoft Access Database OLE Field. Would I need to save the image to the hard drive, then send it to the database field, after which deleting the image? This is the code I ahve so far, and I keep getting Runtime Error Code 91

    Object Variable or With Block Variable not Set.

    Button Click Code:
    [code]
    Private Sub Command1_Click()
    Open_ProvDB
    Open_Harlingen

    Dim Picture1 As Image
    ezVidCap1.SaveDIB "c:ProvidersPicture.bmp"

    With Picture1
    .Picture = LoadPicture("c:ProvidersPicture.bmp")
    End With

    Harlingen.AddNew
    Harlingen.Fields("Picture").Value = Pic1 '<--- Location of Error Code
    Harlingen.Update

    Picture1.Picture = Pic1
    Kill "c:PayrollPicture.bmp"
    End Sub
    [/code]

    ADO Connection Code
    [code]
    Public ProvDB As New ADODB.Connection
    Public Harlingen As New ADODB.Recordset

    Function Open_ProvDB()
    'Checking for instance of open connection, if open it will close
    If ProvDB.State = adStateOpen Then
    ProvDB.Close
    End If

    ProvDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;persist security info =false;data source=C:ProvidersProviders.mdb"

    End Function

    Function Open_Harlingen()
    If Harlingen.State = adStateOpen Then
    Harlingen.Close
    End If
    'setting cursor and open information for recordset table
    With Harlingen
    .ActiveConnection = ProvDB
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
    .LockType = adLockOptimistic
    .Source = "SELECT * FROM Harlingen"
    .Open
    End With

    End Function
    [/code]

    I hope you all can help me.

    The Darthmoob



  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : [code]
    : Private Sub Command1_Click()
    : Open_ProvDB
    : Open_Harlingen
    :
    : Dim Picture1 As Image
    : ezVidCap1.SaveDIB "c:ProvidersPicture.bmp"
    :
    : With Picture1
    : .Picture = LoadPicture("c:ProvidersPicture.bmp")
    : End With
    :
    : Harlingen.AddNew
    : Harlingen.Fields("Picture").Value = Pic1 '<--- Location of Error Code
    : Harlingen.Update
    :
    : Picture1.Picture = Pic1
    : Kill "c:PayrollPicture.bmp"
    : End Sub
    : [/code]
    :

    Does it work when you say: Set Harlingen.Fields("Picture").Value = Pic1?

    Greets...
    Richard

  • darthmoobeydarthmoobey Posts: 140Member
    : : [code]
    : : Private Sub Command1_Click()
    : : Open_ProvDB
    : : Open_Harlingen
    : :
    : : Dim Picture1 As Image
    : : ezVidCap1.SaveDIB "c:ProvidersPicture.bmp"
    : :
    : : With Picture1
    : : .Picture = LoadPicture("c:ProvidersPicture.bmp")
    : : End With
    : :
    : : Harlingen.AddNew
    : : Harlingen.Fields("Picture").Value = Pic1 '<--- Location of Error Code
    : : Harlingen.Update
    : :
    : : Picture1.Picture = Pic1
    : : Kill "c:PayrollPicture.bmp"
    : : End Sub
    : : [/code]
    : :
    :
    : Does it work when you say: Set Harlingen.Fields("Picture").Value = Pic1?
    :
    : Greets...
    : Richard
    :
    :

    Thanks Richar, yes it worked. I read up some more and found that actually saving the pictures in a pictures directory, and using the "name" of the picture as a value in the database to be faster. Saving the PIC as an OLE object inflated my DB far too much for the amount of data I was going to store in there. Thanks for the quick response.

    The Darthmoob
Sign In or Register to comment.