本文整理汇总了C++中ImageList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageList::count方法的具体用法?C++ ImageList::count怎么用?C++ ImageList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageList
的用法示例。
在下文中一共展示了ImageList::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/*----------------------------------------------------------------------------------------------------*/
void Imaging::update() {
ImageList images = mLeapData.getController().images();
int imageCount = images.count();
int64 currSecond = duration_cast<seconds>(system_clock::now().time_since_epoch()).count();
bool sendDistortion = (currSecond >= mNextDistortionSecond);
if ( sendDistortion ) {
mNextDistortionSecond = currSecond+2; //send every X seconds
}
if ( imageCount > 2 ) {
std::cout << "This plugin does not support more than two Leap Motion images." << std::endl;
imageCount = 2;
}
for ( int i = 0 ; i < imageCount ; i++ ) {
Image image = images[i];
sendCameraImage(image);
if ( sendDistortion ) {
sendDistortionImage(image);
}
}
}
示例2: 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;
//.........这里部分代码省略.........