本文整理汇总了C++中getSignal函数的典型用法代码示例。如果您正苦于以下问题:C++ getSignal函数的具体用法?C++ getSignal怎么用?C++ getSignal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSignal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getImage
bool PyrMean::update()
{
const bool rv = Node::update();
if (!rv) return false;
cv::Mat in = getImage("in");
if (in.empty()) return true;
cv::Mat out_3;
cv::Mat in_3 = cv::Mat(in.size(), CV_8UC3, cv::Scalar(0));
// just calling reshape(4) doesn't do the channel reassignment like this does
int ch[] = {0,0, 1,1, 2,2};
cv::mixChannels(&in, 1, &in_3, 1, ch, 3 );
int max_level = getSignal("max_level");
if (max_level > 4) { max_level = 4; setSignal("max_level", max_level); }
if (max_level < 0) { max_level = 0; setSignal("max_level", max_level); }
cv::pyrMeanShiftFiltering(in_3, out_3,
getSignal("sp"), getSignal("sr"),
max_level,
cv::TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, getSignal("term"), 5)
);
cv::Mat out = cv::Mat(out_3.size(), CV_8UC4, cv::Scalar(0));
cv::mixChannels(&out_3, 1, &out, 1, ch, 3 );
setImage("out", out);
}
示例2: while
void GLXPlatformContext::update()
{
XEvent xev;
while(XCheckMaskEvent(mDisplay, StructureNotifyMask, &xev))
{
switch(xev.type)
{
case ConfigureNotify:
if(xev.xconfigure.width != mWidth || xev.xconfigure.height != mHeight)
{
mWidth = xev.xconfigure.width;
mHeight = xev.xconfigure.height;
std::pair<size_t, size_t> report = std::make_pair(mWidth, mHeight);
getSignal("WindowResized")->send(report);
}
break;
case ClientMessage:
if(xev.xclient.data.l[0] == mDeleteMessage)
{
getSignal("WindowClosed")->send(xev.xclient.data.l[0]);
}
break;
}
}
}
示例3: getSignal
void ScrollView::enableMouseEvents()
{
mMouseConnections += getSignal( po::scene::MouseEvent::DOWN_INSIDE ).connect( std::bind( &ScrollView::mouseDownInside, this, ::_1 ) );
mMouseConnections += getSignal( po::scene::MouseEvent::DRAG ).connect( std::bind( &ScrollView::mouseDrag, this, ::_1 ) );
mMouseConnections += getSignal( po::scene::MouseEvent::UP ).connect( std::bind( &ScrollView::mouseUp, this, ::_1 ) );
mMouseEventsEnabled = true;
}
示例4: sin
template<typename T> T ofxAlgebraic_<T>::getTri()
{
float phase = sin(TWO_PI * value * frequency / pointX);
if(phase>0.0){
return getSignal(fmod(value * (frequency*-1) / pointX, 1.0f) * 4 + 1);
} else if(phase<0.0){
return getSignal(fmod(value * frequency / pointX, 1.0f) * 4 - 3.0);
}
}
示例5: getSignal
bool Bezier::update()
{
//if (!ImageNode::update()) return false;
if (!Node::update()) return false;
cv::Mat out = cv::Mat(cv::Size(Config::inst()->im_width, Config::inst()->im_height), MAT_FORMAT_C3);
out = cv::Scalar(0,0,0);
std::vector<cv::Point2f> control_points;
control_points.push_back( cv::Point2f( getSignal("x0"), getSignal("y0") ));
control_points.push_back( cv::Point2f( getSignal("x1"), getSignal("y1") ));
control_points.push_back( cv::Point2f( getSignal("x2"), getSignal("y2") ));
control_points.push_back( cv::Point2f( getSignal("x3"), getSignal("y3") ));
int num = getSignal("num");
if (num < 2) { num = 2;
setSignal("num", num);
}
std::vector<cv::Point2f> bezier_points;
getBezier(control_points, bezier_points, num);
for (int i = 1; i < bezier_points.size(); i++) {
cv::line(out, bezier_points[i-1], bezier_points[i], cv::Scalar(255, 255, 255), 2, CV_AA );
}
setImage("out", out);
return true;
}
示例6: emit
void BlackBoardModel::setVariable(Ogre::String const &name, AgentId const &value)
{
bool isNew = mVariables.end() == mVariables.find(name);
mVariables.erase(name);
mVariables[name] = Ogre::StringConverter::toString(value);
if(isNew)
emit(getSignal(PublicSignal::newVariable));
else
emit(getSignal(PublicSignal::variableChanged));
}
示例7: addChild
void MaskingSample::setup()
{
ci::app::getWindow()->getSignalKeyUp().connect(std::bind(&MaskingSample::keyUp, this, std::placeholders::_1));
// Load the mask texture
ci::gl::TextureRef maskTexture = ci::gl::Texture::create(ci::loadImage(ci::app::loadAsset("circle_mask_blurred.jpg")));
// Create the mask shape
//mMask = Shape::create(maskTexture);
mMask = Shape::createRect(100, 100);
mMask->setAlignment(Alignment::CENTER_CENTER);
mMask->setPosition(ci::app::getWindowWidth()/2, ci::app::getWindowHeight()/2);
ci::app::timeline().apply(&mMask->getRotationAnim(), 0.0f, ci::toRadians(360.0f), 1.0f).loop();
ci::app::timeline().apply(&mMask->getScaleAnim(), ci::vec2(1.0f, 1.0f), ci::vec2(4.0f, 4.0f), 1.0f).loop().pingPong();
// Load the image texture
ci::gl::TextureRef texture = ci::gl::Texture::create(ci::loadImage(ci::app::loadAsset("cat.jpg")));
// Create the image shape
mImage = Image::create(texture);
addChild(mImage);
// Set the image mask
setMask(mMask);
// Connect mouse event
getSignal(MouseEvent::MOVE).connect(std::bind(&MaskingSample::onMouseMove, this, std::placeholders::_1));
}
示例8: getImage
bool Contour::update()
{
//if (!ImageNode::update()) return false;
if (!Node::update()) return false;
cv::Mat in = getImage("in");
if (in.empty()) {
VLOG(2) << name << " in is empty";
return false;
}
if (!isDirty(this, 22)) { return true;}
std::vector<std::vector<cv::Point> > contours_orig;
cv::Mat in8;
cv::cvtColor(in, in8, CV_RGB2GRAY);
cv::findContours(in8, contours_orig, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_SIMPLE);
const float eps = getSignal("epsilon"); // max error of approx
contours0.resize(contours_orig.size());
for( size_t k = 0; k < contours_orig.size(); k++ )
//approxPolyDP(cv::Mat(contours_orig[k]), contours0[k], eps, true);
approxPolyDP((contours_orig[k]), contours0[k], eps, true);
cv::Mat out = cv::Mat(Config::inst()->getImSize(), MAT_FORMAT_C3, cv::Scalar(0,0,0,255));
cv::drawContours( out, contours0, -1, cv::Scalar(255,255,255,255));
//1, CV_AA, hierarchy, std::abs(_levels) );
setImage("out", out);
return true;
}
示例9: getTile
int TileSource::isBlockProvidingPowerTo(int x, int y, int z, int side) {
int id = getTile(x, y, z).id;
if(id == 0) return 0;
int (*getSignal)(Tile*, TileSource*, int, int, int, int) = (int (*)(Tile*, TileSource*, int, int, int, int)) Tile::tiles[id]->vtable[VT_TILE_GETSIGNAL];
return getSignal(Tile::tiles[id], this, x, y, z, side);
}
示例10: getImage
bool Output::update()
{
if (!ImageNode::update()) return false;
cv::Mat in = getImage("in");
if (in.empty()) return true;
if (!ximage) return true;
XWindowAttributes xwAttr;
Status ret = XGetWindowAttributes( display, win, &xwAttr );
int screen_w = xwAttr.width;
int screen_h = xwAttr.height;
setSignal("disp_w", screen_w);
setSignal("disp_h", screen_h);
// TBD is this necessary or does X do it for me if the window is resized?
cv::Size sz = cv::Size(screen_w, screen_h);
cv::Mat scaled;
cv::resize(in, scaled, sz, 0, 0, cv::INTER_NEAREST );
XDestroyImage(ximage);
ximage = XGetImage(display, DefaultRootWindow(display), 0, 0, screen_w, screen_h, AllPlanes, ZPixmap);
bm::matToXImage(scaled, ximage, win, *display, *screen);
bool window_decorations_on = getSignal("decor");
setSignal("decor", window_decorations_on);
bm::setWindowDecorations(display, win, window_decorations_on);
}
示例11: error
/**
* Message AppConfig::getMessage(QVector<QString> messageBlock)
*
* Takes a block of strings corresponding to one CAN message definition as
* input and returns a Message struct with all applicable parameters set. This
* function will throw errors if the input data is missing or malformed.
*
* @param messageBlock - The block of strings corresponding to one CAN message
* defintion
* @returns A Message struct with all applicable parameters set, or an empty
* Message struct if an error occurred.
*/
Message AppConfig::getMessage(QVector<QString> messageBlock) {
QString msgDef = messageBlock[0];
QStringList sections = msgDef.split(" ", QString::SkipEmptyParts);
if (sections.size() != 5) {
emit error("Invalid message definition.");
return Message();
}
Message msg;
bool successful = true;
msg.id = sections[1].toUInt(&successful);
if (!successful) {
emit error(QString("Invalid message ID"));
return Message();
}
msg.dlc = sections[3].toUInt(&successful);
if (!successful) {
emit error(QString("Invalid DLC for message with ID: %1").arg(QString::number(msg.id, 16)));
return Message();
}
for (int i = 1; i < messageBlock.size(); i++) {
Signal sig = getSignal(messageBlock[i]);
if (!sig.valid()) {
return Message();
}
msg.sigs.push_back(sig);
}
return msg;
}
示例12: getPercentCurvedSignal
int RSSIFilter::getPercentCurvedSignal()
{
float rawcurved = (getSignal() / _max_quality_signal) * (_upper_scale - _lower_scale) + _lower_scale;
if(rawcurved < 0.01) return 0;
if(rawcurved > 0.99) return 100;
return (int)((-log((1-rawcurved)/rawcurved) - _scale_min) * 100 / (_scale_max - _scale_min) + 0.5);
}
示例13: StopMongoProgram
BSONObj StopMongoProgram( const BSONObj &a ) {
assert( a.nFields() == 1 || a.nFields() == 2 );
assert( a.firstElement().isNumber() );
int port = int( a.firstElement().number() );
killDb( port, 0, getSignal( a ) );
cout << "shell: stopped mongo program on port " << port << endl;
return undefined_;
}
示例14: getSignal
void OISSubsystem::_mouseButton(uint button, bool up)
{
mButtonStates[button] = up;
if(!up)
{
getSignal(String("released_")+String(mButtons[button]))->fire(
MessageAny<uint>(button));
getSignal("mouseReleased")->fire(MessageAny<uint>(button));
}
else
{
mButtonPresses[button] = true;
getSignal("mousePressed")->fire(MessageAny<uint>(button));
getSignal(String("pressed_")+String(mButtons[button]))->fire(
MessageAny<uint>(button));
}
}
示例15: StopMongoProgramByPid
BSONObj StopMongoProgramByPid( const BSONObj &a, void* data ) {
verify( a.nFields() == 1 || a.nFields() == 2 );
uassert( 15852 , "stopMongoByPid needs a number" , a.firstElement().isNumber() );
ProcessId pid = ProcessId::fromNative(int( a.firstElement().number() ));
int code = killDb( 0, pid, getSignal( a ) );
log() << "shell: stopped mongo program on pid " << pid << endl;
return BSON( "" << (double)code );
}