OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 5129|回复: 5

小白求教!关于VS2015调用open cv库实现人脸识别困境

[复制链接]
发表于 2019-3-28 15:01:28 | 显示全部楼层 |阅读模式
小白本人使用VS2015和open cv3.2,用vs调用open cv实现人脸检测时,代码调试过程中提示如下:(左边标红部分是提示错误代码段。右边是是编译提示的错误)
//-- 2. 打开内置摄像头视频流
    capture = cvCaptureFromCAM(-1);
    if (capture)
    {
        while (true)
        {
            frame = cvQueryFrame(capture);                                       C2679    二进制“=”: 没有找到接受“IplImage *”类型的右操作数的运算符(或没有可  接受的转换)   
            //-- 3. 对当前帧使用分类器进行检测                                   没有与这些操作数匹配的 "=" 运算符    

            if (!frame.empty())
            {
                detectAndDisplay(frame);
            }
            else
            {
                printf(" --(!) No captured frame -- Break!"); break;
            }

            int c = waitKey(10);
            if ((char)c == 'c') { break; }
        }
    }

我初步判断是frame和cvqueryframe两端的类型不同,所以不能赋值,可是不知道怎么转换一下。求大佬指点一下!谢谢。

回复

使用道具 举报

 楼主| 发表于 2019-3-28 15:16:08 | 显示全部楼层

回复 支持 反对

使用道具 举报

发表于 2019-5-15 21:12:25 | 显示全部楼层
给你个借鉴:
Mat frame_ing = new Mat();
//定义视频对象
VideoCapture cap = new VideoCapture();
//获取摄像头对象   0表示第一个摄像头设备
cap = VideoCapture.FromCamera(0);
if (!cap.IsOpened())
            {
                MessageBox.Show("视频打开失败,请联系管理员。。。");
            }
            else
            {
//循环读取摄像头每一帧
                while (cap.Read(frame_ing))
                {
                      //逻辑代码
                }
           }
回复 支持 反对

使用道具 举报

发表于 2019-9-3 15:10:22 | 显示全部楼层
#include "stdafx.h"
#include "FaceDetect.h"
#include "FaceDetectDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFaceDetectApp

BEGIN_MESSAGE_MAP(CFaceDetectApp, CWinApp)
        //{{AFX_MSG_MAP(CFaceDetectApp)
                // NOTE - the ClassWizard will add and remove mapping macros here.
                //    DO NOT EDIT what you see in these blocks of generated code!
        //}}AFX_MSG
        ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFaceDetectApp construction

CFaceDetectApp::CFaceDetectApp()
{
        // TODO: add construction code here,
        // Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CFaceDetectApp object

CFaceDetectApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CFaceDetectApp initialization

BOOL CFaceDetectApp::InitInstance()
{
        AfxEnableControlContainer();

        // Standard initialization
        // If you are not using these features and wish to reduce the size
        //  of your final executable, you should remove from the following
        //  the specific initialization routines you do not need.

#ifdef _AFXDLL
        Enable3dControls();                        // Call this when using MFC in a shared DLL
#else
        Enable3dControlsStatic();        // Call this when linking to MFC statically
#endif

        CFaceDetectDlg dlg;
        m_pMainWnd = &dlg;
        int nResponse = dlg.DoModal();
        if (nResponse == IDOK)
        {
                // TODO: Place code here to handle when the dialog is
                //  dismissed with OK
        }
        else if (nResponse == IDCANCEL)
        {
                // TODO: Place code here to handle when the dialog is
                //  dismissed with Cancel
        }

        // Since the dialog has been closed, return FALSE so that we exit the
        //  application, rather than start the application's message pump.
        return FALSE;
}
有源代码及演示,给我发信息,我发给你。
回复 支持 反对

使用道具 举报

发表于 2019-9-3 15:12:05 | 显示全部楼层
opencv的也可以,我这里做的都是C\C++,但要有一个xml文件,我这里用opencv的只有脸和嘴吧的定位。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-3-29 05:53 , Processed in 0.010486 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表