本文整理汇总了C++中params::InterfaceGlRef::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceGlRef::clear方法的具体用法?C++ InterfaceGlRef::clear怎么用?C++ InterfaceGlRef::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params::InterfaceGlRef
的用法示例。
在下文中一共展示了InterfaceGlRef::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeGUI
void OpenCVTemplateApp::makeGUI() {
interface->clear();
interface->addButton("load image", [this] {
auto path = ci::app::getOpenFilePath();
image = cv::imread(path.string());
std::cout <<"cols "<<image.cols << std::endl;
std::cout <<"rows "<<image.rows << std::endl;
std::cout <<"channels "<<image.channels() << std::endl;
imageTexture = gl::Texture::create(fromOcv(image));
});
interface->addButton("load video", [this] {
auto path = ci::app::getOpenFilePath();
video.open(path.string());
frameWidth = video.get(cv::CAP_PROP_FRAME_WIDTH);
frameHeight = video.get(cv::CAP_PROP_FRAME_HEIGHT);
totalFrames = video.get(cv::CAP_PROP_FRAME_COUNT);
video.read(frame);
if(isGrayScale) {
cv::cvtColor(frame, frame, cv::COLOR_BGR2GRAY);
}
frameTexture = gl::Texture::create(fromOcv(frame));
makeGUI();
});
interface->addSeparator();
if(frameTexture) {
interface->addParam("gray scale", &isGrayScale).updateFn([this] {
video.retrieve(frame);
if(isGrayScale) {
cv::cvtColor(frame, frame, cv::COLOR_BGR2GRAY);
}
frameTexture = gl::Texture::create(fromOcv(frame));
makeGUI();
});
interface->addParam("nb of feature",&nbOfFeaturePoints).min(1).max(1000);
if(isGrayScale) {
interface->addButton("get feature points", [this] {
cv::goodFeaturesToTrack(frame, featurePoints, nbOfFeaturePoints, 0.01, 10, cv::Mat(), 3, 0, 0.04);
});
}
interface->addSeparator();
interface->addParam("frame",&frameIndex).min(0).max(totalFrames-1).step(1).updateFn([this] {
video.set(cv::CAP_PROP_POS_FRAMES,frameIndex);
video.read(frame);
if(isGrayScale) {
cv::cvtColor(frame, frame, cv::COLOR_BGR2GRAY);
}
frameTexture = gl::Texture::create(fromOcv(frame));
});
interface->addSeparator();
interface->addParam("speed", &frameSpeed).min(1).max(1000).step(1);
interface->addButton("play",[this] {
currentState = PLAY;
makeGUI();
});
if(currentState == PLAY) {
interface->addButton("pause",[this] {
currentState = PAUSE;
makeGUI();
});
}
}
}