cv::RotatedRect MxArray::toRotatedRect(mwIndex index) const { cv::RotatedRect rr; if (isField("center")) rr.center = at("center", index).toPoint_<float>(); if (isField("size")) rr.size = at("size", index).toSize_<float>(); if (isField("angle")) rr.angle = at("angle", index).toFloat(); return rr; }
cv::DMatch MxArray::toDMatch(mwIndex index) const { return cv::DMatch( (isField("queryIdx")) ? at("queryIdx", index).toInt() : 0, (isField("trainIdx")) ? at("trainIdx", index).toInt() : 0, (isField("imgIdx")) ? at("imgIdx", index).toInt() : 0, (isField("distance")) ? at("distance", index).toDouble() : 0 ); }
cv::KeyPoint MxArray::toKeyPoint(mwIndex index) const { return cv::KeyPoint( at("pt", index).toPoint2f(), at("size", index).toDouble(), (isField("angle")) ? at("angle", index).toDouble() : -1, (isField("response")) ? at("response", index).toDouble() : 0, (isField("octave")) ? at("octave", index).toInt() : 0, (isField("class_id")) ? at("class_id", index).toInt() : -1 ); }
cv::Moments MxArray::toMoments(mwIndex index) const { return cv::Moments( (isField("m00")) ? at("m00", index).toDouble() : 0, (isField("m10")) ? at("m10", index).toDouble() : 0, (isField("m01")) ? at("m01", index).toDouble() : 0, (isField("m20")) ? at("m20", index).toDouble() : 0, (isField("m11")) ? at("m11", index).toDouble() : 0, (isField("m02")) ? at("m02", index).toDouble() : 0, (isField("m30")) ? at("m30", index).toDouble() : 0, (isField("m12")) ? at("m12", index).toDouble() : 0, (isField("m21")) ? at("m21", index).toDouble() : 0, (isField("m03")) ? at("m03", index).toDouble() : 0 ); }
bool ParameterListCallbackBlocked<LocalOrdinalT,GlobalOrdinalT,Node>::handlesRequest(const Teko::RequestMesg & rm) { // check if is a parameter list message, and that the parameter // list contains the right fields if(rm.getName()=="Parameter List") { bool isHandled = true; Teuchos::RCP<const Teuchos::ParameterList> pl = rm.getParameterList(); std::string field; if(pl->isType<std::string>("x-coordinates")) { field = pl->get<std::string>("x-coordinates"); if(!isField(field)) { return false; } } if(pl->isType<std::string>("y-coordinates")) { // we assume that the fields must be the same if(field != pl->get<std::string>("y-coordinates")) { return false; } } if(pl->isType<std::string>("z-coordinates")) { // we assume that the fields must be the same if(field != pl->get<std::string>("z-coordinates")) { return false; } } return isHandled; } else return false; }
void VarDeclaration::toJson(JsonOut *json) { json->objectStart(); jsonProperties(json); if (init) json->property("init", init->toChars()); if (isField()) json->property("offset", offset); if (alignment && alignment != STRUCTALIGN_DEFAULT) json->property("align", alignment); json->objectEnd(); }
int VarDeclaration::cvMember(unsigned char *p) { int nwritten = 0; //printf("VarDeclaration::cvMember(p = %p) '%s'\n", p, toChars()); if (type->toBasetype()->ty == Ttuple) return 0; char *id = toChars(); if (!p) { if (isField()) { if (config.fulltypes == CV8) nwritten += 2; nwritten += 6 + cv_stringbytes(id); nwritten += cv4_numericbytes(offset); } else if (isStatic()) { if (config.fulltypes == CV8) nwritten += 2; nwritten += 6 + cv_stringbytes(id); } nwritten = cv_align(NULL, nwritten); } else { idx_t typidx = cv_typidx(type->toCtype()); unsigned attribute = PROTtoATTR(prot()); assert((attribute & ~3) == 0); switch (config.fulltypes) { case CV8: if (isField()) { TOWORD(p,LF_MEMBER_V3); TOWORD(p + 2,attribute); TOLONG(p + 4,typidx); cv4_storenumeric(p + 8, offset); nwritten = 8 + cv4_numericbytes( offset); nwritten += cv_namestring(p + nwritten, id); } else if (isStatic()) { TOWORD(p,LF_STMEMBER_V3); TOWORD(p + 2,attribute); TOLONG(p + 4,typidx); nwritten = 8; nwritten += cv_namestring(p + nwritten, id); } break; case CV4: if (isField()) { TOWORD(p,LF_MEMBER); TOWORD(p + 2,typidx); TOWORD(p + 4,attribute); cv4_storenumeric(p + 6, offset); nwritten = 6 + cv4_numericbytes( offset); nwritten += cv_namestring(p + nwritten, id); } else if (isStatic()) { TOWORD(p,LF_STMEMBER); TOWORD(p + 2,typidx); TOWORD(p + 4,attribute); nwritten = 6; nwritten += cv_namestring(p + nwritten, id); } break; default: assert(0); } nwritten = cv_align(p + nwritten, nwritten); #ifdef DEBUG assert(nwritten == cvMember(NULL)); #endif } return nwritten; }
const bool Uniforms::isUniform( const std::string& name ) const { return isAnUniformName(name) && isField( name ); }