TyErrorId initialize(AnnotatorContext &ctx) { outInfo("initialize"); if(ctx.isParameterDefined("boardRows")) { ctx.extractValue("boardRows", boardRows); } if(ctx.isParameterDefined("boardCols")) { ctx.extractValue("boardCols", boardCols); } if(ctx.isParameterDefined("boardDistX")) { ctx.extractValue("boardDistX", boardDistX); } if(ctx.isParameterDefined("boardDistY")) { ctx.extractValue("boardDistY", boardDistY); } if(ctx.isParameterDefined("boardType")) { std::string sType; ctx.extractValue("boardType", sType); if(sType == "circle") { boardType = CIRCLE; } else if(sType == "chess") { boardType = CHESS; } } boardSize = cv::Size(boardCols, boardRows); // Create world points pointsWorld = cv::Mat(boardRows * boardCols, 3, CV_32F); for(size_t r = 0; r < pointsWorld.rows; ++r) { float *it = pointsWorld.ptr<float>(r); *it++ = boardDistX * (r % boardCols); *it++ = boardDistY * (r / boardCols); *it++ = 0; } return UIMA_ERR_NONE; }
virtual TyErrorId train(AnnotatorContext &ctx, const cv::Mat &descriptors, const cv::Mat &responses) { if(ctx.isParameterDefined("kNN")) { ctx.extractValue("kNN", kNN); } if(ctx.isParameterDefined("maxK")) { ctx.extractValue("maxK", maxK); } if(ctx.isParameterDefined("isRegression")) { ctx.extractValue("isRegression", isRegression); } model->train(descriptors, responses, cv::Mat(), isRegression, maxK); return UIMA_ERR_NONE; }
TyErrorId initialize(AnnotatorContext &ctx) { outInfo("Initialize"); if(ctx.isParameterDefined("use_transform")) { ctx.extractValue("use_transform", use_transform); } if(ctx.isParameterDefined("voxel_resolution")) { ctx.extractValue("voxel_resolution", voxel_resolution); } if(ctx.isParameterDefined("seed_resolution")) { ctx.extractValue("seed_resolution", seed_resolution); } if(ctx.isParameterDefined("color_importance")) { ctx.extractValue("color_importance", color_importance); } if(ctx.isParameterDefined("spatial_importance")) { ctx.extractValue("spatial_importance", spatial_importance); } if(ctx.isParameterDefined("normal_importance")) { ctx.extractValue("normal_importance", normal_importance); } return UIMA_ERR_NONE; }
TyErrorId initialize(AnnotatorContext &ctx) { if(ctx.isParameterDefined("minValueColor")) { ctx.extractValue("minValueColor", minValueColor); } if(ctx.isParameterDefined("minSaturationColor")) { ctx.extractValue("minSaturationColor", minSaturationColor); } if(ctx.isParameterDefined("maxValueBlack")) { ctx.extractValue("maxValueBlack", maxValueBlack); } if(ctx.isParameterDefined("minValueWhite")) { ctx.extractValue("minValueWhite", minValueWhite); } if(ctx.isParameterDefined("histogramCols")) { ctx.extractValue("histogramCols", histogramCols); } if(ctx.isParameterDefined("histogramRows")) { ctx.extractValue("histogramRows", histogramRows); } return UIMA_ERR_NONE; }
TyErrorId initialize(AnnotatorContext &ctx) { outInfo("initialize"); if(ctx.isParameterDefined("border")) { ctx.extractValue("border", border); } std::vector<std::string *> temp; if(ctx.isParameterDefined("defaultRegions")) { ctx.extractValue("defaultRegions", temp); for(auto s : temp) { outInfo(*s); defaultRegions.push_back(*s); } } if(ctx.isParameterDefined("enable_change_detection")) { ctx.extractValue("enable_change_detection", changeDetection); } if(ctx.isParameterDefined("enable_frustum_culling")) { ctx.extractValue("enable_frustum_culling", frustumCulling_); } if(ctx.isParameterDefined("pixel_threshold")) { ctx.extractValue("pixel_threshold", pixelThreshold); } if(ctx.isParameterDefined("depth_threshold")) { ctx.extractValue("depth_threshold", depthThreshold); } if(ctx.isParameterDefined("global_threshold")) { ctx.extractValue("global_threshold", threshold); } if(ctx.isParameterDefined("change_timeout")) { int tmp = 120; ctx.extractValue("change_timeout", tmp); timeout = tmp; } return UIMA_ERR_NONE; }
/* * Initializes annotator */ TyErrorId initialize(AnnotatorContext &ctx) { outInfo("initialize"); if(ctx.isParameterDefined("keypointDetector")) { ctx.extractValue("keypointDetector", keypointDetector); } else { outError("no keypoint detector provided!"); return UIMA_ERR_ANNOTATOR_MISSING_INIT; } if(ctx.isParameterDefined("featureExtractor")) { ctx.extractValue("featureExtractor", featureExtractor); } else { outError("no feature extractor provided!"); return UIMA_ERR_ANNOTATOR_MISSING_INIT; } outDebug("creating " << keypointDetector << " key points detector..."); detector = cv::FeatureDetector::create(keypointDetector); if(detector.empty()) { outError("creation failed!"); return UIMA_ERR_ANNOTATOR_MISSING_INIT; } #if OUT_LEVEL == OUT_LEVEL_DEBUG printParams(detector); #endif setupAlgorithm(detector); outDebug("creating " << featureExtractor << " feature extractor..."); extractor = cv::DescriptorExtractor::create(featureExtractor); if(extractor.empty()) { outError("creation failed!"); return UIMA_ERR_ANNOTATOR_MISSING_INIT; } #if OUT_LEVEL == OUT_LEVEL_DEBUG printParams(extractor); #endif setupAlgorithm(extractor); if(featureExtractor == "SIFT" || featureExtractor == "SURF") { featureType = "numerical"; } else { featureType = "binary"; } return UIMA_ERR_NONE; }