Ejemplo n.º 1
0
void MainWindow::perpare_for_recording(IplImage* image)
{
	ReleaseVideoWriter();

	int fps     = 10;  // or 30
	int frameW  = image->width;
	int frameH  = image->height;
	QString filename = get_record_filename();

	writer = cvCreateVideoWriter(filename.toAscii().constData(),CV_FOURCC('X', 'V', 'I', 'D'),fps,cvSize(frameW,frameH),1);
}
Ejemplo n.º 2
0
//start the tracker
void MainWindow::start_tracking()
{
	cvNamedWindow("binary");
	cvNamedWindow("vid");
	IplImage* image=NULL;
	IplImage* binary_image = NULL;

	//int k = 0;      //skipped frame count
	clock_t start_time = clock();

	while(tracker_state == STATE_STARTED_TRACKING && 
		((image = video_loader.next_frame())!= NULL))
	{
		tracker->next_image(image);
		binary_image = tracker->get_binary_model();
		draw_targets(image);

		//Record when there is substantial motion
		if (config->record_activity) {
			cout << "RECORDING" << endl;
			record_activity(image);
		}

		cvShowImage("binary", binary_image);
		cvShowImage("vid", image);
		cvWaitKey(1);
	}

	clock_t elapsed_time = clock() - start_time;

	cout << "clock ticks = " << elapsed_time << endl;
	cout << "seconds = " << (float)elapsed_time/(float)CLOCKS_PER_SEC << endl;


	if (tracker_state == STATE_STARTED_TRACKING && !image)
	{
		//video is over, terminate tracking.
		tracker->end_tracking();
		ReleaseVideoWriter();
		ReleaseVideoBuffer();
		tracker_state = STATE_NOT_STARTED;

		//Update the trace table
		update_trace_list();
		//Update the target table
		update_target_list();
		//Update the elevator list table
		update_event_list();

		update_gui();
	}

}
Ejemplo n.º 3
0
void MainWindow::on_exit_clicked()
{
	QMessageBox msgBox;
	msgBox.setText("Would you like to exit the application?");
	msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
	msgBox.setDefaultButton(QMessageBox::No);
	if (msgBox.exec()==QMessageBox::Yes) {
		ReleaseVideoWriter();
		ReleaseVideoBuffer();
		exit(0);
	}
}
void exportVideoRenderTarget::closeRenderTarget() throw(Error_sV)
{	
	VideoWriter* writer;;

	qDebug() << "exporting temporary frame to Video" << m_filename << " using codec " << m_vcodec << "starting at " << first;
	if (m_vcodec.isEmpty()) 
		writer = CreateVideoWriter(m_filename.toStdString().c_str(),
			renderTask()->resolution().width(),
			renderTask()->resolution().height(),
			renderTask()->fps().fps(),use_qt,0);
	else
		writer = CreateVideoWriter(m_filename.toStdString().c_str(),
			renderTask()->resolution().width(),
			renderTask()->resolution().height(),
			renderTask()->fps().fps(),use_qt,m_vcodec.toStdString().c_str());
   
    if (writer == 0) {
        throw Error_sV(QObject::tr("Video could not be prepared .\n"));
    }
	exportFrames(writer, m_targetDir.absoluteFilePath(m_filenamePattern.arg("%05d")).toStdString().c_str(),first,renderTask());
	ReleaseVideoWriter( &writer );
}
Ejemplo n.º 5
0
void newVideoRenderTarget::closeRenderTarget() throw(Error_sV)
{
    ReleaseVideoWriter( &writer );
}