• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cvCaptureFromFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cvCaptureFromFile函数的典型用法代码示例。如果您正苦于以下问题:C++ cvCaptureFromFile函数的具体用法?C++ cvCaptureFromFile怎么用?C++ cvCaptureFromFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cvCaptureFromFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main (int argc, char **argv)
{
  CvCapture* capture=cvCaptureFromFile(argv[1]);
  
  IplImage * frame;
  IplImage * frameNB;
  char c;
  cvNamedWindow("Exemple video", CV_WINDOW_AUTOSIZE);
  cvNamedWindow("Exemple video NB", CV_WINDOW_AUTOSIZE);
  while(1){
    frame = cvQueryFrame(capture);
    if(frame==NULL){ 
      break;
      printf("Caramba, pas vu pas pris!\n");
    }
    frameNB = cvCreateImage(cvGetSize(frame),IPL_DEPTH_8U,1);
    cvCvtColor(frame, frameNB, CV_BGR2GRAY);
    cvShowImage("Exemple video", frame);
    cvShowImage("Exemple video NB", frameNB);
    c=cvWaitKey(33);/*attente de 33ms*/
    
      if(c==27) break;/* touche esc*/
    cvReleaseImage(&frameNB);
  }
    
  cvReleaseCapture(&capture);
  cvDestroyWindow("Exemple video");
  return(0);
}
开发者ID:hafidatabet,项目名称:myResources,代码行数:29,代码来源:exo242.c


示例2: main

int main(){
    
    //initialize
    IplImage *frame;
    CvCapture *video = cvCaptureFromFile("/Users/ihong-gyu/MyProject/OpenCVTest/video.mp4");
    
    //create window
    cvNamedWindow("Video",0);
    
    //show video
    while(1){
        cvGrabFrame(video);
        frame = cvRetrieveFrame(video);
        
        //null checker
        if(!frame)
            break;
        cvShowImage("Video", frame);
        
        //wait key input
        if(cvWaitKey(10)>=0)
            break;
    }
    
    //release memory
    cvReleaseCapture(&video);
    
    
    
    
    return 0;
}
开发者ID:proauto,项目名称:OpenCV_practice,代码行数:32,代码来源:video_play.cpp


示例3: cvCaptureFromFile

  void VideoCapture::setUpVideo()
  {
    capture = cvCaptureFromFile(videoFileName.c_str());

    if (!capture)
      std::cerr << "Cannot open video file " << videoFileName << std::endl;
  }
开发者ID:2php,项目名称:ShadowDetection,代码行数:7,代码来源:VideoCapture.cpp


示例4: InitCapture

bool InitCapture(const char* param)
{
    /*if( param!=NULL || (param==NULL && strlen(param) == 1 && isdigit(param[0])))
        capture = cvCaptureFromCAM( !param ? param[0] - '0' : CV_CAP_ANY );
	 
    else //if( argc == 2 )*/
        capture = cvCaptureFromFile( param ); 

    if( !capture )
    {
        fprintf(stderr,"Could not initialize capturing from %s...\n",param);
        return false;
    }

	// set frame offset
	if (frame_begin>0)
	  if (!cvSetCaptureProperty(capture,CV_CAP_PROP_POS_FRAMES,frame_begin))
	  {
	    printf("Could not start capture from frame %d in %s\n",frame_begin,param);
	    printf(" -> bugfix: fast-forward to the frame %d ...\n",frame_begin);
	    if(capture){
	      int fn=0;
	      while (fn<frame_begin){
		frame = cvQueryFrame( capture );
		if( !frame )
		  break;
		fn++;
	      }
	    }
	    printf("    done.\n");
	    //return false;
	  }
	 
	return true;
}
开发者ID:AAAyag,项目名称:handinput,代码行数:35,代码来源:stdetect.cpp


示例5: FindValue

OpenCVReader::OpenCVReader(list<vector<string> > configList)
{
	int notLoaded = 0;
	int tempCameraInput = 0;
	notLoaded += FindValue(configList, "CVCameraInput", tempCameraInput);
	assert(!notLoaded);
	cameraInput = (tempCameraInput != 0);
	if (!cameraInput)
	{
		notLoaded += FindValue(configList, "CVMovieFileInput", fileName);
		assert(!notLoaded);
		cvImageReader = cvCaptureFromFile(fileName);
	}
	else
	{
		notLoaded += FindValue(configList, "CVCameraNumber", cameraNumber);
		assert(!notLoaded);
		cvImageReader = cvCaptureFromCAM(cameraNumber);
	}
	assert(cvImageReader);
	IplImage* cvImage = cvQueryFrame(cvImageReader);
	assert(cvImage);
	height = cvImage->height;
	width = cvImage->width;
	channels = cvImage->nChannels;
	reset();
	//cout << "Height: " << height << " Width: " << width << " Channels: " << channels << endl;
}
开发者ID:bwhite,项目名称:white-knight,代码行数:28,代码来源:OpenCVReader.cpp


示例6: initialize

void initialize()
{
//Camera capture and image variables
img=cvCreateImage(cvSize(w,h),8,3);
thresh=cvCreateImage(cvSize(w,h),8,1);


//	capture=cvCreateCameraCapture(1);
	if (movie_id == 1)
	{
		capture=cvCaptureFromFile("GATSBY-1024.mov");
		printf("loading movie_id %d\n", movie_id);
	}
	
// printf("test\n");	
	//Initial capture settings
	
	cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, w);
 	cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, h);
// 	
	//Windows
 	cvNamedWindow("Original",CV_WINDOW_AUTOSIZE);
 	cvNamedWindow("Thresholded",CV_WINDOW_AUTOSIZE);
 	cvNamedWindow("cnt",CV_WINDOW_AUTOSIZE);
	//Creating the sliders
	cvCreateTrackbar("B1","cnt",&b1,255,0);
	cvCreateTrackbar("B2","cnt",&b2,255,0);
	cvCreateTrackbar("G1","cnt",&g1,255,0);
	cvCreateTrackbar("G2","cnt",&g2,255,0);
	cvCreateTrackbar("R1","cnt",&r1,255,0);
	cvCreateTrackbar("R2","cnt",&r2,255,0);
}
开发者ID:nimazad,项目名称:FS-CBRTS,代码行数:32,代码来源:ColorSlider_new.c


示例7: rb_open

/*
 * call-seq:
 *   CvCapture.open(<i>[dev = -1]</i>)
 *
 * Reading video stream from the specified file or camera device.
 * If <i>dev</i> is string (i.e "stream.avi"), reading video stream from file.
 * If <i>dev</i> is number or symbol(include CvCapture::INTERFACE),
 * reading video stream from camera. 
 * Currently two camera interfaces can be used on Windows:
 * * Video for Windows(VFW)
 * * Matrox Imaging Library(MIL)
 * and two on Linux
 * * V4L
 * * FireWire(IEEE1394).
 * If there is only one camera or it does not matter what camera to use <i>nil</i> may be passed.
 */
VALUE
rb_open(int argc, VALUE *argv, VALUE self)
{
  VALUE device;
  rb_scan_args(argc, argv, "01", &device);
  CvCapture *capture = 0;
  try {
    switch (TYPE(device)) {
    case T_STRING:
      capture = cvCaptureFromFile(StringValueCStr(device));
      break;
    case T_FIXNUM:
      capture = cvCaptureFromCAM(FIX2INT(device));
      break;
    case T_SYMBOL: {
      VALUE cap_index = rb_hash_lookup(rb_const_get(rb_class(), rb_intern("INTERFACE")), device);
      if (NIL_P(cap_index))
        rb_raise(rb_eArgError, "undefined interface.");
      capture = cvCaptureFromCAM(NUM2INT(cap_index));
      break;
    }
    case T_NIL:
      capture = cvCaptureFromCAM(CV_CAP_ANY);
      break;
    }
  }
  catch (cv::Exception& e) {
    raise_cverror(e);
  }
  if (!capture)
    rb_raise(rb_eStandardError, "Invalid capture format.");
  return Data_Wrap_Struct(rb_klass, 0, cvcapture_free, capture);
}
开发者ID:iceydee,项目名称:ruby-opencv,代码行数:49,代码来源:cvcapture.cpp


示例8: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	IplImage* pFrame = NULL; 
	CvCapture* pCapture = NULL;

	pCapture = cvCaptureFromFile("synopsis1_cam2_0.avi");
	Cdlbk testModule;

	while(pFrame = cvQueryFrame( pCapture ))
    {
		testModule.Process(pFrame->width, pFrame->height, (unsigned char *)pFrame->imageData);

		//IplImage *bk = cvCreateImage( cvSize(pFrame->width, pFrame->height), IPL_DEPTH_8U, 3 );
		//IplImage *seg = cvCreateImage( cvSize(pFrame->width, pFrame->height), IPL_DEPTH_8U, 1 );
		//memcpy(bk->imageData, testModule.GetBack(), sizeof(uchar)*320*240*3);
		//memcpy(seg->imageData, testModule.GetFore(), sizeof(uchar)*320*240*1);
		//cvShowImage("video", bk);
		//cvShowImage("video1", seg);
		//cvReleaseImage(&bk);
		//cvReleaseImage(&seg);

		//cvShowImage("video", testModule.GetBack());
		//cvShowImage("video", pFrame);
		//如果有按键事件,则跳出循环
		//此等待也为cvShowImage函数提供时间完成显示
		//等待时间可以根据CPU速度调整
		cvWaitKey(10);
		//break;
    }

	cvReleaseCapture(&pCapture);

	return 0;
}
开发者ID:elfmedy,项目名称:2013,代码行数:34,代码来源:dlbkTest.cpp


示例9: opendir

void MyVideo::loadResource(char* folder) {
    //search the folder for images and video
    DIR *dir = NULL;
    dirent *ent = NULL;

    dir = opendir(folder);

    //if the folder is invalid
    if (dir == NULL) {
        cout<<"Invalid folder"<<endl;
        return;
    }

    //get all the files
    while ((ent = readdir(dir)) != NULL) {
        //find the first '.'
        char* suffix = (char*)malloc(sizeof(char));
        sscanf(ent->d_name, "%*[^.]%s", suffix);
        char* input_src = (char*)malloc(sizeof(char));
        strcpy(input_src, folder);
        strcat(input_src, ent->d_name);
        if((strcmp(suffix, ".avi") == 0)&&(ent->d_name[0]!='.')) {
            inputvideo = cvCaptureFromFile(input_src);
        }
        if((strcmp(suffix, ".jpg") == 0)&&(ent->d_name[0]!='.')) {
            IplImage *p = cvLoadImage(input_src, 1);
            images.push_back(p);
        }
    }
    width = (int)cvGetCaptureProperty(inputvideo, 3);
    height = (int)cvGetCaptureProperty(inputvideo, 4);
    fps = (int)cvGetCaptureProperty(inputvideo, 5);
    fourcc = (int)cvGetCaptureProperty(inputvideo, 6);
    framecount = (int)cvGetCaptureProperty(inputvideo, 7);
}
开发者ID:AprilWong,项目名称:video-wizard,代码行数:35,代码来源:myvideo.cpp


示例10: rb_open

/*
 * call-seq:
 *   CvCapture.open(<i>[dev = -1]</i>)
 *
 * Reading video stream from the specified file or camera device.
 * If <i>dev</i> is string (i.e "stream.avi"), reading video stream from file.
 * If <i>dev</i> is number or symbol(include CvCapture::INTERFACE),
 * reading video stream from camera. 
 * Currently two camera interfaces can be used on Windows:
 * * Video for Windows(VFW)
 * * Matrox Imaging Library(MIL)
 * and two on Linux
 * * V4L
 * * FireWire(IEEE1394).
 * If there is only one camera or it does not matter what camera to use <i>nil</i> may be passed.
 */
VALUE
rb_open(int argc, VALUE *argv, VALUE self)
{
  VALUE device, i;
  rb_scan_args(argc, argv, "01", &device);
  CvCapture *capture = 0;
  switch (TYPE(device)) {
  case T_STRING:
    capture = cvCaptureFromFile(StringValueCStr(device));
    break;
  case T_FIXNUM:
    capture = cvCaptureFromCAM(FIX2INT(device));
    break;
  case T_SYMBOL:    
    i = rb_hash_aref(rb_const_get(rb_class(), rb_intern("INTERFACE")), device);
    if (NIL_P(i))
      rb_raise(rb_eArgError, "undefined interface.");
    capture = cvCaptureFromCAM(NUM2INT(i));
    break;
  case T_NIL:
    capture = cvCaptureFromCAM(CV_CAP_ANY);
    break;
  }
  if (!capture)
    rb_raise(rb_eStandardError, "Invalid capture format.");
  return Data_Wrap_Struct(rb_klass, 0, free, capture);
}
开发者ID:thenoseman,项目名称:ruby-opencv,代码行数:43,代码来源:cvcapture.cpp


示例11: main

int
main(int argc, char *argv[])
{
    CvCapture *capture = NULL;
    IplImage *src_frame, *image, *dst_frame;
    char *infile, *outfile;
    Matrix matrix;
    Args args;
    int64 t0, t1;
    double tps, deltatime;
    CvVideoWriter *writer;
    CvSize size;
    double fps;
    int frame_count;
    int i;

    infile = argv[1];
    outfile = argv[2];
    args.c = argc - 3;
    for (i = 0; i < 3; i++)
        args.v[i] = argv[i + 3];
    capture = cvCaptureFromFile(infile);
    if (capture == NULL) {
        printf("Could not load video \"%s\".\n", infile);
        return EXIT_FAILURE;
    }
    src_frame = cvQueryFrame(capture);
    fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
    size = cvSize(
        (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH),
        (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT)
    );
    writer = cvCreateVideoWriter(outfile, CV_FOURCC('M', 'J', 'P', 'G'), fps, size, 1);
    printf("Saving to \"%s\"...\n", outfile);
    image = cvCreateImage(size, IPL_DEPTH_8U, 1);
    dst_frame = cvCreateImage(size, IPL_DEPTH_8U, 3);
    matrix.width = dst_frame->width;
    matrix.height = dst_frame->height;
    frame_count = 0;
    t0 = cvGetTickCount();
    while ((src_frame = cvQueryFrame(capture)) != NULL) {
        cvCvtColor(src_frame, image, CV_BGR2GRAY);
        matrix.data = (unsigned char *) image->imageData;
        proc(&matrix, &args);
        cvCvtColor(image, dst_frame, CV_GRAY2BGR);
        cvWriteFrame(writer, dst_frame);
        frame_count++;
    }
    t1 = cvGetTickCount();
    tps = cvGetTickFrequency() * 1.0e6;
    deltatime = (double) (t1 - t0) / tps;
    printf("%d frames of %dx%d processed in %.3f seconds.\n",
           frame_count, dst_frame->width, dst_frame->height,
           deltatime);
    cvReleaseVideoWriter(&writer);
    cvReleaseImage(&dst_frame);
    cvReleaseCapture(&capture);
    return EXIT_SUCCESS;
}
开发者ID:lecram,项目名称:ipg,代码行数:59,代码来源:vid.c


示例12: main

int
main (int argc, char **argv)
{
  CvCapture *capture = 0;
  IplImage *frame = 0;
  CvVideoWriter *writer;
  int c, num = 0;
  //CvFont font;
  //char str[64];

  double fps, width, height;
  if ( argc == 1 || (argc >= 2 && strlen (argv[1]) == 1 && isdigit (argv[1][0])) )
  {
    capture = cvCreateCameraCapture (argc == 2 ? argv[1][0] - '0' : 0);
    fps     = 20.0;
    width   = 320;
    height  = 240;
    //fps     = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
    //cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_WIDTH, width);
    //cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_HEIGHT, height);
  }
  else if ( argc >= 2 )
  {
    capture = cvCaptureFromFile(argv[1]);
    fps     = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
    width   = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
    height  = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
  }
  printf ("fps=%f width=%f height=%f\n", fps, width, height);

  printf ("Write to cap.avi. Finish with Esc.\n");
  // FourCC http://www.fourcc.org/codecs.php
  //writer = cvCreateVideoWriter( "cap.avi", 
  //                              CV_FOURCC('D','I','V','X'),
  //                              fps, cvSize((int)width,(int)height) );
  writer = cvCreateVideoWriter( "cap.avi", -1,
      fps, cvSize((int)width,(int)height) );

  //cvInitFont (&font, CV_FONT_HERSHEY_COMPLEX, 0.7, 0.7);
  cvNamedWindow ("Capture", CV_WINDOW_AUTOSIZE);

  while (1) {
    frame = cvQueryFrame (capture);
    if( frame == NULL ) break;
    //snprintf (str, 64, "%03d[frame]", num);
    //cvPutText (frame, str, cvPoint (10, 20), &font, CV_RGB (0, 255, 100));
    cvWriteFrame (writer, frame);
    cvShowImage ("Capture", frame);
    num++;
    c = cvWaitKey (10);
    if (c == 'q') // exit
      break;
  }
  cvReleaseVideoWriter (&writer);
  cvReleaseCapture (&capture);
  cvDestroyWindow ("Capture");

  return 0;
}
开发者ID:andrey1227,项目名称:opencvx,代码行数:59,代码来源:cvvideowriter.cpp


示例13: sprintf

DLLEXPORT frameGrabber::frameGrabber(separ_device_avi_conf_t* an_avi)
{
	this->init_grabber();
	this->avi_conf=an_avi;
	sprintf(this->ss_fname,"%s",an_avi->file);		
	capture = cvCaptureFromFile(this->ss_fname);
	this->frame=new frame_description();
}
开发者ID:fithisux,项目名称:XSEP,代码行数:8,代码来源:frameGrabber.cpp


示例14: main223

int main223(int argc, char* argv[])
{   /* Main function: */
	CvCapture*                  pCap = NULL;
	CvBlobTrackerAutoParam1     param = { 0, 0, 0, 0, 0, 0, 0, 0 };
	CvBlobTrackerAuto*          pTracker = NULL;

	//float       scale = 1;
	const char* scale_name = NULL;
	char*       yml_name = NULL;
	char**      yml_video_names = NULL;
	int         yml_video_num = 0;
	char*       avi_name = NULL;
	const char* fg_name = NULL;
	char*       fgavi_name = NULL;
	char*       btavi_name = NULL;
	const char* bd_name = NULL;
	const char* bt_name = NULL;
	const char* btgen_name = NULL;
	const char* btpp_name = NULL;
	const char* bta_name = NULL;
	char*       bta_data_name = NULL;
	char*       track_name = NULL;
	//char*       comment_name = NULL;
	char*       FGTrainFrames = NULL;
	char*       log_name = NULL;
	char*       savestate_name = NULL;
	char*       loadstate_name = NULL;
	const char* bt_corr = NULL;




	avi_name = "RGB.avi";
	btavi_name = "";
	/* Create source video: */
	if (avi_name)
		pCap = cvCaptureFromFile(avi_name);//打开视频
	//pCap = cvCreateCameraCapture(-1);//从摄像头中读取数据。
	if (pCap == NULL)
	{
		printf("Can't open %s file\n", avi_name);
		return -1;
	}

	//初始化pTracker

	/* Run pipeline: //开始流水线。流水线退出,意味着程序结束,
	这里出错了*/
	//RunBlobTrackingAuto(pCap, pTracker, fgavi_name, btavi_name);

	pTracker = cvCreateBlobTrackerAuto1();
	//pTracker->m_Wnd = 1;
	RunBlobTrackingAuto2323(pCap, pTracker, fgavi_name, btavi_name);


	if (pCap)	cvReleaseCapture(&pCap);
	return 0;
}   /* main() */
开发者ID:xiawei0000,项目名称:indoorMonitorwithKinectV2,代码行数:58,代码来源:mainblob.cpp


示例15: cvCaptureFromFile

void Capture::init(const std::string &filename)
{
    m_capture = cvCaptureFromFile(filename.c_str());
    if ( m_capture == NULL )
    {
        boost::system::error_code errcode;
        throw Exception(boost::format("Can't open file %1%: %2%")
                        % filename % errcode.message());
    }
}
开发者ID:flair2005,项目名称:ThunderVision,代码行数:10,代码来源:captureproc.cpp


示例16: cvGetCaptureProperty

IplImage * VideoBackground::GetBackground()
{
	int current = cvGetCaptureProperty(m_capture, CV_CAP_PROP_POS_FRAMES);
	int last = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FRAME_COUNT);
	if(current == last) 
	{
		cvReleaseCapture(&m_capture);
		m_capture = cvCaptureFromFile(m_filename.c_str());
	}
	return cvQueryFrame(m_capture);
}
开发者ID:Onumis,项目名称:Face-Detect,代码行数:11,代码来源:VideoBackground.cpp


示例17: cvCaptureFromFile

static CvCapture *abrir_video(const char *archivo_entrada) {
    CvCapture *srcVid = NULL;
    srcVid = cvCaptureFromFile(archivo_entrada);
    if( srcVid == NULL) {
        /* Esto no está documentado. No debería pasar nunca. */
        fprintf(stderr, "Invalid srcVid\n%s \n", archivo_entrada);
        exit(EXIT_FAILURE);
    }

    return srcVid;
}
开发者ID:axelstram,项目名称:orga2-tp2,代码行数:11,代码来源:tp2.c


示例18: cvReleaseCapture

void AVIReader::open() {
	if (videoCap)
		cvReleaseCapture(&videoCap);
	videoCap = cvCaptureFromFile(filePath.c_str());
	if (!videoCap)
		repErr("Cannot open %s\n", filePath.c_str());
	_w = (int) cvGetCaptureProperty(videoCap, CV_CAP_PROP_FRAME_WIDTH);
	_h = (int) cvGetCaptureProperty(videoCap, CV_CAP_PROP_FRAME_HEIGHT);

	assert(_w > 0 && _h > 0);
	_timestamp = 0;
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:12,代码来源:SL_AVIReader.cpp


示例19: connect

void MainWindow::openFile()
{
    learnRate = 0.01;
    connect(&time1, &QTimer::timeout, this, &MainWindow::updateImage);
    QString fileFull = QFileDialog::getOpenFileName(this,"Open","D:/");
    //QFileInfo fi = QFileInfo(fileFull);
    //QString fileName1 = fi.fileName().trimmed();
    //file_path = fi.absolutePath();
    const QByteArray text = fileFull.toLocal8Bit();
    fileName = text.data();
    capture = cvCaptureFromFile(fileName);
}
开发者ID:LogisticFreedom,项目名称:Moving-Objects-Detected-and-Recongnation-System,代码行数:12,代码来源:mainwindow.cpp


示例20: demo_regressor

void demo_regressor(char *datacfg, char *cfgfile, char *weightfile, int cam_index, const char *filename)
{
#ifdef OPENCV
    printf("Regressor Demo\n");
    network net = parse_network_cfg(cfgfile);
    if(weightfile){
        load_weights(&net, weightfile);
    }
    set_batch_network(&net, 1);

    srand(2222222);
    CvCapture * cap;

    if(filename){
        cap = cvCaptureFromFile(filename);
    }else{
        cap = cvCaptureFromCAM(cam_index);
    }

    if(!cap) error("Couldn't connect to webcam.\n");
    cvNamedWindow("Regressor", CV_WINDOW_NORMAL); 
    cvResizeWindow("Regressor", 512, 512);
    float fps = 0;

    while(1){
        struct timeval tval_before, tval_after, tval_result;
        gettimeofday(&tval_before, NULL);

        image in = get_image_from_stream(cap);
        image in_s = letterbox_image(in, net.w, net.h);
        show_image(in, "Regressor");

        float *predictions = network_predict(net, in_s.data);

        printf("\033[2J");
        printf("\033[1;1H");
        printf("\nFPS:%.0f\n",fps);

        printf("People: %f\n", predictions[0]);

        free_image(in_s);
        free_image(in);

        cvWaitKey(10);

        gettimeofday(&tval_after, NULL);
        timersub(&tval_after, &tval_before, &tval_result);
        float curr = 1000000.f/((long int)tval_result.tv_usec);
        fps = .9*fps + .1*curr;
    }
#endif
}
开发者ID:NomokoAG,项目名称:darknet,代码行数:52,代码来源:regressor.c



注:本文中的cvCaptureFromFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cvClearMemStorage函数代码示例发布时间:2022-05-30
下一篇:
C++ cvCaptureFromCAM函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap