当前位置: 首页>>代码示例>>C++>>正文


C++ Evaluator::stopVid方法代码示例

本文整理汇总了C++中Evaluator::stopVid方法的典型用法代码示例。如果您正苦于以下问题:C++ Evaluator::stopVid方法的具体用法?C++ Evaluator::stopVid怎么用?C++ Evaluator::stopVid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Evaluator的用法示例。


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

示例1: main


//.........这里部分代码省略.........

			if (recognizer.getLetterFound() == true){				//if recognizer found the sign we looked for
				evaluator.setEuclideanDistance(recognizer.getEuclideanDistance());	//set euclidean distance
				evaluator.stopTimer();						//stop timer and write to file
			}

			if (!recognizer.getBlueBLOBImg().empty())
				imshow("blue blob", recognizer.getBlueBLOBImg());			//Showing BLOB-analyzed images
			if (!recognizer.getGreenBLOBImg().empty())
				imshow("green blob", recognizer.getGreenBLOBImg());
			if (!recognizer.getRedBLOBImg().empty())
				imshow("red blob", recognizer.getRedBLOBImg());
			if (!recognizer.getYellowBLOBImg().empty())
				imshow("yellow blob", recognizer.getYellowBLOBImg());
			
		}
		else if (gloveNumber == 2){
			resize(capturedFrame, capturedFrame, Size(capturedFrame.cols / 3, capturedFrame.rows / 3));

			detector.thresholdForGlove2(capturedFrame);					//thresholding

			
			//imshow("blue thresh", detector.getBlueThreshImg());		//showing thresholded images
			//imshow("green thresh", detector.getGreenThreshImg());
			//imshow("pink thresh", detector.getPinkThreshImg());
			//imshow("red thresh", detector.getRedThreshImg());
			//imshow("yellow thresh", detector.getYellowThreshImg());

			recognizer.setDetector(detector);								//setting the detector for the recognizer

			if (evaluator.getTimerHasStarted() == false)					//if timer isn't currently going
				evaluator.startTimer(letter, capturedFrame, gloveNumber);	//start timer
			else															//saves the thresholded videos to files
				evaluator.saveThreshVid(capturedFrame, detector.getBlueThreshImg(), detector.getGreenThreshImg(), detector.getPinkThreshImg(), detector.getRedThreshImg(), detector.getYellowThreshImg(), letter, gloveNumber);	//ensures every frame is saved to the video file

			//recognizer.recognizeGlove2(letter, leftHand);					//recognizing for the chosen letter
			recognizer.vectorRecognizerGlove2(letter, leftHand);

			resize(capturedFrame, capturedFrame, Size(640, 480));

			String correct = "You are ";
			correct += to_string(recognizer.percentage(recognizer.getEuclideanDistance()));
			correct += "% correct";

			Scalar color;

			if (recognizer.percentage(recognizer.getEuclideanDistance()) < 90)
				color = Scalar(0, 0, 255);
			else
				color = Scalar(0, 255, 0);

			putText(capturedFrame, correct, Point(capturedFrame.cols / 3, capturedFrame.rows - capturedFrame.rows/6), FONT_HERSHEY_SIMPLEX, 0.8, color, 2);
			String letterStr = "";
			letterStr += letter;
			putText(capturedFrame, letterStr, Point(capturedFrame.cols - capturedFrame.cols / 10, capturedFrame.rows / 10), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0,0,0), 2);

			//saves the BLOB videos to files
			evaluator.saveBLOBVid(recognizer.getBlueBLOBImg(), recognizer.getGreenBLOBImg(), recognizer.getPinkBLOBImg(), recognizer.getRedBLOBImg(), recognizer.getYellowBLOBImg(), letter, gloveNumber);

			if (recognizer.getLetterFound() == true){				//if recognizer found the sign we looked for
				evaluator.setEuclideanDistance(recognizer.getEuclideanDistance());	//set euclidean distance
				evaluator.stopTimer();						//stop timer and write to file

				if (letterIndex < 5)
					letterIndex++;
				else
					letterIndex = 0;

				letter = letters[letterIndex];

			}

			

			if (!recognizer.getBlueBLOBImg().empty())
				imshow("blue blob", recognizer.getBlueBLOBImg());			//Showing BLOB-analyzed images
			if (!recognizer.getGreenBLOBImg().empty())
				imshow("green blob", recognizer.getGreenBLOBImg());
			if (!recognizer.getRedBLOBImg().empty())
				imshow("red blob", recognizer.getRedBLOBImg());
			if (!recognizer.getYellowBLOBImg().empty())
				imshow("yellow blob", recognizer.getYellowBLOBImg());
			if (!recognizer.getPinkBLOBImg().empty())
				imshow("pink blob", recognizer.getPinkBLOBImg());
		}
		else{
			output = detector.segmentFrame(capturedFrame);				//segmenting current frame
			imshow("Thresholded", output);								//showing output
		}

		imshow("camWin", capturedFrame);
		
		if (waitKey(30) == 27)	{										//(check every 30 ms) if 'esc'-key has been pressed by user
			evaluator.stopVid();
			break;														//break the loop
		}
	}

	return 0;
}
开发者ID:eamea,项目名称:P3project,代码行数:101,代码来源:main.cpp


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