これが私のコードです。Web カメラを開き、フレームを取得し、小さなウィンドウにサイズを縮小して、GetCaptureProperty でフレーム レートを取得しようとします。
GetCaptureProperty 関数を見つけることができず、私も見つけることができません (Opencv モジュール フォルダー内のすべてのフォルダーをクリックしました)。何か案は?
#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <Windows.h>
#include <time.h>
using namespace std;
using namespace cv;
Mat output;
int _tmain(int argc, _TCHAR* argv[])
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) { // check if we succeeded
cout << "NO camera found \n";
return -1;
}
Mat src,smallsrc;
cap >> src; //grab 1 frame
output.create(src.rows,src.cols,CV_8UC3); //create empty 3 channel frame
namedWindow( "source", CV_WINDOW_AUTOSIZE );
moveWindow("source",2000,100); //create a small original capture off to the side of screen
for(;;)
{
if( GetAsyncKeyState(27)) cin.get() ; //if esc is pressed, pause execution till ENTER is pressed
/// Load an image
cap >> src;
if( !src.data )
{ return -1; }
resize(src,smallsrc,Size(),.5,.5); //smaller scale window of original
imshow("source",smallsrc);
int msc = cvGetCaptureProperty(smallsrc,CV_CAP_PROP_POS_MSEC);
int frmrate = GetCaptureProperty(smallsrc,CV_CAP_PROP_FPS);
int frmcount = getCaptureProperty(smallsrc,CV_CAP_PROP_POS_FRAMES);
waitKey(30);
}
return 0;
}
エラーは次のとおりです。
1>------ Build started: Project: getcaptureproperty, Configuration: Debug x64 ------
1> getcaptureproperty.cpp
1>getcaptureproperty.cpp(34): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>getcaptureproperty.cpp(46): error C2664: 'cvGetCaptureProperty' : cannot convert parameter 1 from 'cv::Mat' to 'CvCapture *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>getcaptureproperty.cpp(47): error C3861: 'GetCaptureProperty': identifier not found
1>getcaptureproperty.cpp(48): error C3861: 'getCaptureProperty': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========