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


C++ ImageList::isEmpty方法代码示例

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


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

示例1: main

int main() {
	//leap motion data
	Controller controller;
	controller.setPolicy(Leap::Controller::POLICY_IMAGES);
	controller.setPolicy(Leap::Controller::POLICY_BACKGROUND_FRAMES);

	//process variables
	int updateRate;
	int frameAmount; //amount of frame to record
	int counter;
	bool done;
	FileStorage fs;
	vector<string> imagelist;
	FileNode n;
	FileNodeIterator it, it_begin, it_end;
	Size boardSize;
	int64 t1, t2;
	double time;
	Vector slopes_left, slopes_right, position;
	float cameraZ, cameraY, cameraX;

	//behavior options	
	Behaviour behaviour;
	
start:
	//initialization
	updateRate = 100;
	frameAmount = 20; //amount of frame to record
	counter = 0;
	done = false;
	imagelist.clear();
	time = 0;

	behaviour = CheckBehaviour();
	if (behaviour == Quit) return 0;
	else {
		system("cls");
		std::cout << "Press 'q' to quit, 'r' to restart (set focus on image window)\n";
	}

	char key = ' ';
	while (key != 'q' && key != 'r') {

		key = waitKey(updateRate); //refresh rate

		//image acquisition
		Frame frame = controller.frame();
		if (!frame.isValid()) {
			//std::cout << "Frame is Invalid" << std::endl;
			continue;
		}

		ImageList images = frame.images();
		if (images.isEmpty() || images.count() == 1) {
			//std::cout << "imageList.isEmpty()" << std::endl;
			continue;
		}

		Image imageLeft = images[0];
		Image imageRight = images[1];

		cvImgLeft = Mat(imageLeft.height(), imageLeft.width(), CV_8UC1);
		cvImgRight = Mat(imageRight.height(), imageRight.width(), CV_8UC1);		

		cvImgLeft.data = (unsigned char*)imageLeft.data();
		cvImgRight.data = (unsigned char*)imageRight.data();

		//image output
		imshow("Left image", cvImgLeft);
		imshow("Right image", cvImgRight);

		//behaviour check
		switch (behaviour) {
		case Show_images:
			//do nothing
			break;
		case Undistort_images:
			//use Leap Motion distortion map
			UndistortLeap(imageLeft, "Undistorted left image", true);
			UndistortLeap(imageRight, "Undistorted right image", true);
			break;
		case Calib_image_recording:
			//record calibration images
			counter++;
			//done = imgSave(cvImgLeft, cvImgRight, frameAmount, counter);
			done = imgSave(UndistortLeap(imageLeft, "Undistorted left image", true), UndistortLeap(imageRight, "Undistorted right image", true), frameAmount, counter);
			if (done) {
				system("cls");
				std::cout << "Images for calibration recorded!" <<
					"\nPress 'q' to quit, 'r' to restart (set focus on image window)";
				behaviour = Show_images;
			}
			break;
		case Stereo_calibration:
			//read calibration names to list			
			fs.open(calibFileNames, FileStorage::READ);
			n = fs["strings"];                         // Read string sequence - Get node
			if (n.type() != FileNode::SEQ)
			{
				cerr << "strings is not a sequence! FAIL" << endl;
//.........这里部分代码省略.........
开发者ID:cbrpnkrd,项目名称:PS_Move_position_tracking,代码行数:101,代码来源:main.cpp


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