| 52 | } |
| 53 | |
| 54 | bool IPLFeatureDetection::processInputData(IPLData* data, int, bool useOpenCV) |
| 55 | { |
| 56 | IPLImage* image = data->toImage(); |
| 57 | |
| 58 | int width = image->width(); |
| 59 | int height = image->height(); |
| 60 | int progress = 0; |
| 61 | int maxProgress = ((image->type() == IPL_IMAGE_COLOR)? 9 : 8)*height; |
| 62 | |
| 63 | // get properties |
| 64 | int algorithm = getProcessPropertyInt("algorithm"); |
| 65 | double threshold = getProcessPropertyDouble("threshold"); |
| 66 | bool nonmaxSuppression = getProcessPropertyBool("nonmaxSuppression"); |
| 67 | int minHessian = getProcessPropertyInt("minHessian"); |
| 68 | |
| 69 | notifyProgressEventHandler(-1); |
| 70 | cv::Mat input; |
| 71 | cv::Mat output; |
| 72 | cvtColor(image->toCvMat(), input, CV_BGR2GRAY); |
| 73 | input.copyTo(output); |
| 74 | |
| 75 | //cv::OrbFeatureDetector detector; |
| 76 | std::vector<cv::KeyPoint> keypoints; |
| 77 | //cv::Ptr<cv::ORB> detector = cv::ORB::create(300, 1.2f, 4, 31, 0, 2, cv::ORB::FAST_SCORE, 31, 20); |
| 78 | cv::FAST(input, keypoints, threshold, nonmaxSuppression); |
| 79 | //cv::Ptr<cv::SURF> detector = cv::SURF::create( minHessian ); |
| 80 | //detector.detect(input, keypoints); |
| 81 | cv::drawKeypoints(input, keypoints, output); |
| 82 | |
| 83 | delete _preview; |
| 84 | _preview = new IPLImage(output); |
| 85 | delete _keypoints; |
| 86 | _keypoints = new IPLKeyPoints; |
| 87 | _keypoints->set(keypoints); |
| 88 | |
| 89 | return true; |
| 90 | } |
| 91 | |
| 92 | IPLData* IPLFeatureDetection::getResultData( int index ) |
| 93 | { |