How to use opencv library in visual C++?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: How to use opencv library in visual C++?

  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Smile How to use opencv library in visual C++?

    Dear all,
    I want to make a simple face recognition application with visual C++ and I want to use opencv library. Please tell me how to use opencv library in visual C++(detail,please).
    Thanks.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,639

    Re: How to use opencv library in visual C++?

    Please don't cross post...
    Just add the library under project properties/linker/additional libraries.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    Apr 2009
    Posts
    4

    Re: How to use opencv library in visual C++?

    Slep.....1

    * C:\Program Files\OpenCV\cv\include

    * C:\Program Files\OpenCV\cxcore\include

    * C:\Program Files\OpenCV\otherlibs\highgui

    Give project properties/(C/C++)/General/aditional include Directories


    Step2:
    cxcore.lib
    cv.lib
    highgui.lib
    Give project properties/linker/Input/additional dependence

    Step3:

    "C:\Program Files\OpenCV\lib"
    Give project properties/linker/General/additional library directories

    step4:

    #include "cv.h"
    #include "cxcore.h"
    #include "highgui.h"


    (OR)

    http://www.site.uottawa.ca/~laganier...ow/cvision.htm

  4. #4
    Join Date
    Oct 2009
    Posts
    3

    Re: How to use opencv library in visual C++?

    I know this forum doesnt discuss about errors encountered while using opencv libraries in vs, but I am unable to find any related forum. It would be helpful if someone helps me out.

    #include "stdafx.h"
    #include <cv.h>
    #include <cxcore.h>
    #include <highgui.h>

    int hsw = 0, hi = 0, lsw = 0, li = 0;

    void swh(int p)
    {
    hi = p;
    }

    void swl(int p)
    {
    li = p;
    }

    int _tmain(int argc, _TCHAR* argv[])
    {
    int n = 7;
    IplImage* img = cvLoadImage( "img1.jpeg", 0 );
    IplImage* img_b = cvCreateImage( cvSize(img->width+n-1,img->height+n-1), img->depth, img->nChannels );
    IplImage* out = cvCreateImage( cvGetSize(img_b), IPL_DEPTH_8U, img_b->nChannels );
    CvPoint off = cvPoint((n-1)/2,(n-1)/2);
    cvCopyMakeBorder(img,img_b,off,IPL_BORDER_REPLICATE,cvScalarAll(0));
    cvNamedWindow("Canny Edge Detection",1);
    int as = n;
    double lt = 20;
    double ht = 40;
    cvCreateTrackbar( "High", "Canny Edge Detection", &hsw, 4, swh );
    cvCreateTrackbar( "Low", "Canny Edge Detection", &lsw, 4, swl );
    while( 1 ) {
    switch( hi ){
    case 0:
    ht = 200;
    break;
    case 1:
    ht = 400;
    break;
    case 2:
    ht = 600;
    break;
    case 3:
    ht = 800;
    break;
    case 4:
    ht = 1000;
    break;
    }
    switch( li ){
    case 0:
    lt = 0;
    break;
    case 1:
    lt = 100;
    break;
    case 2:
    lt = 200;
    break;
    case 3:
    lt = 400;
    break;
    case 4:
    lt = 600;
    break;
    }

    // Edge Detection
    cvCanny( img_b, out, lt*n*n, ht*n*n, as );
    cvShowImage("Canny Edge Detection", out);
    if( cvWaitKey( 15 ) == 27 )
    break;
    }
    cvReleaseImage( &img );
    cvReleaseImage( &img_b );
    cvReleaseImage( &out );
    cvDestroyWindow( "Canny Edge Detection" );
    return 0;
    }

    This is my code. When I run it, I get the following error :

    The procedure entry point cvCreateTrackbar could not be located in the dynamic link library libcv200.dll.

    Where am I going wrong? How should I correct it

  5. #5
    Join Date
    Nov 2009
    Location
    Indore(India)
    Posts
    29

    Re: How to use opencv library in visual C++?

    Quote Originally Posted by nauva View Post
    Dear all,
    I want to make a simple face recognition application with visual C++ and I want to use opencv library. Please tell me how to use opencv library in visual C++(detail,please).
    Thanks.
    Include lib file
    Project - Properties - Configuration Properties - Linker - Input - Additional Dependencies,
    Add line
    #include "libfile.h"

  6. #6
    Join Date
    Apr 2009
    Posts
    4

    Find child nodes from Parent node in Asp.Net

    This program helps to find out list of members/Nodes under each node.

    For example: Tree Chart
    A

    B C D

    E F G

    H I

    J

    Answer:
    The Total No. of Nodes under A is: 9
    The Total No. of Nodes under B is: 5
    The Total No. of Nodes under C is: 0
    The Total No. of Nodes under D is: 1
    The Total No. of Nodes under E is: 3
    The Total No. of Nodes under F is: 0
    The Total No. of Nodes under G is: 0
    The Total No. of Nodes under H is: 0
    The Total No. of Nodes under I is: 1
    The Total No. of Nodes under J is: 0



    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
    SqlConnection ObjCon = new SqlConnection("server=localhost;uid=sa;pwd=garuda;
    database=muthu");
    SqlDataAdapter ObjDA = new SqlDataAdapter();
    DataSet ObjDS = new DataSet();
    int iDataCount = 0;
    ObjCon.Open();

    /**************For array length********************/

    ObjDA = new SqlDataAdapter("select count(*) from tblmlmarketing ", ObjCon);
    ObjDA.Fill(ObjDS);
    foreach (DataRow ObjDR in ObjDS.Tables[0].Rows)
    {
    iDataCount = Int32.Parse(ObjDR[0].ToString());
    //i++;
    }
    ObjDS.Tables.Clear();
    int[] arr = new int[iDataCount*2];
    int i = -1;

    /**************For Find Parant child********************/
    ObjDA = new SqlDataAdapter("select vcClientId from tblmlmarketing where vcMasterId='" +
    DropDownList1.Text + "'", ObjCon); //.......................................... Input :
    ObjDA.Fill(ObjDS);
    foreach (DataRow ObjDR in ObjDS.Tables[0].Rows)
    arr[++i] = Int32.Parse(ObjDR[0].ToString());

    /**************For Find another Child********************/
    for (int j = 0; j < arr.Length;j++)
    {
    ObjDS.Tables.Clear();
    if (arr[j] == 0)
    {
    txtData.Text = j.ToString(); //.......................................... Output :
    break;
    }
    string sData = arr[j].ToString();
    ObjDA = new SqlDataAdapter("select vcClientId from tblmlmarketing where
    vcMasterID='" + sData + "'", ObjCon);
    ObjDA.Fill(ObjDS);
    foreach (DataRow ObjDR in ObjDS.Tables[0].Rows)
    {
    arr[++i] = Int32.Parse(ObjDR[0].ToString());
    }

    }

  7. #7
    Join Date
    Dec 2009
    Posts
    10

    Re: How to use opencv library in visual C++?

    Many of the companies in business today are still following the traditional ins-outs system on paper. And this can create some problems for employees. You don’t need to note down your in time or out time if you implement employee time tracking software. This is software that can help you in maintaining the records of projects and employees’ working hours in an effective manner.

    For more information about , visit on link: http://www.project-drive.net/

  8. #8
    Join Date
    Jul 2011
    Posts
    1

    Timesheet management

    Our telephone and web-based employee time clock system is totally optimized for the web (unlike typical client/server technology). As a result, our system is fast and very easy to use.



    web time clock

  9. #9
    Join Date
    Nov 2011
    Posts
    2

    Re: How to use opencv library in visual C++?

    Quote Originally Posted by sathya8819 View Post
    I know this forum doesnt discuss about errors encountered while using opencv libraries in vs, but I am unable to find any related forum. It would be helpful if someone helps me out.

    #include "stdafx.h"
    #include <cv.h>
    #include <cxcore.h>
    #include <highgui.h>

    int hsw = 0, hi = 0, lsw = 0, li = 0;

    void swh(int p)
    {
    hi = p;
    }

    void swl(int p)
    {
    li = p;
    }

    int _tmain(int argc, _TCHAR* argv[])
    {
    int n = 7;
    IplImage* img = cvLoadImage( "img1.jpeg", 0 );
    IplImage* img_b = cvCreateImage( cvSize(img->width+n-1,img->height+n-1), img->depth, img->nChannels );
    IplImage* out = cvCreateImage( cvGetSize(img_b), IPL_DEPTH_8U, img_b->nChannels );
    CvPoint off = cvPoint((n-1)/2,(n-1)/2);
    cvCopyMakeBorder(img,img_b,off,IPL_BORDER_REPLICATE,cvScalarAll(0));
    cvNamedWindow("Canny Edge Detection",1);
    int as = n;
    double lt = 20;
    double ht = 40;
    cvCreateTrackbar( "High", "Canny Edge Detection", &hsw, 4, swh );
    cvCreateTrackbar( "Low", "Canny Edge Detection", &lsw, 4, swl );
    while( 1 ) {
    switch( hi ){
    case 0:
    ht = 200;
    break;
    case 1:
    ht = 400;
    break;
    case 2:
    ht = 600;
    break;
    case 3:
    ht = 800;
    break;
    case 4:
    ht = 1000;
    break;
    }
    switch( li ){
    case 0:
    lt = 0;
    break;
    case 1:
    lt = 100;
    break;
    case 2:
    lt = 200;
    break;
    case 3:
    lt = 400;
    break;
    case 4:
    lt = 600;
    break;
    }

    // Edge Detection
    cvCanny( img_b, out, lt*n*n, ht*n*n, as );
    cvShowImage("Canny Edge Detection", out);
    if( cvWaitKey( 15 ) == 27 )
    break;
    }
    cvReleaseImage( &img );
    cvReleaseImage( &img_b );
    cvReleaseImage( &out );
    cvDestroyWindow( "Canny Edge Detection" );
    return 0;
    }

    This is my code. When I run it, I get the following error :

    The procedure entry point cvCreateTrackbar could not be located in the dynamic link library libcv200.dll.

    Where am I going wrong? How should I correct it
    Thanks for sharing these codding, PHP Development India I have tired to find that finally I got it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center