| 63 | } |
| 64 | |
| 65 | bool IPLFeatureMatcher::processInputData(IPLData* data , int index, bool useOpenCV) |
| 66 | { |
| 67 | if(index == 0) |
| 68 | { |
| 69 | _image1 = data->toImage(); |
| 70 | } |
| 71 | else if(index == 1) |
| 72 | { |
| 73 | _image2 = data->toImage(); |
| 74 | } |
| 75 | else if(index == 2) |
| 76 | { |
| 77 | std::stringstream s; |
| 78 | s << "Number of Keypoints 1: "; |
| 79 | s << data->toKeyPoints()->size(); |
| 80 | addInformation(s.str()); |
| 81 | _keypoints1 = data->toKeyPoints(); |
| 82 | } |
| 83 | else if(index == 3) |
| 84 | { |
| 85 | _keypoints2 = data->toKeyPoints(); |
| 86 | } |
| 87 | else |
| 88 | { |
| 89 | return false; |
| 90 | } |
| 91 | |
| 92 | if(_image1 && _image2 && _keypoints1 && _keypoints2) { |
| 93 | |
| 94 | // get properties |
| 95 | int algorithm = getProcessPropertyInt("algorithm"); |
| 96 | int hessianThreshold = getProcessPropertyInt("hessianThreshold"); |
| 97 | int nOctaves = getProcessPropertyInt("nOctaves"); |
| 98 | int nOctaveLayers = getProcessPropertyInt("nOctaveLayers"); |
| 99 | bool extended = getProcessPropertyBool("extended"); |
| 100 | bool upright = getProcessPropertyBool("upright"); |
| 101 | |
| 102 | notifyProgressEventHandler(-1); |
| 103 | cv::Mat input1; |
| 104 | cv::Mat input2; |
| 105 | cv::Mat output; |
| 106 | std::vector<cv::KeyPoint> keypoints1 = *_keypoints1->get(); |
| 107 | std::vector<cv::KeyPoint> keypoints2 = *_keypoints2->get(); |
| 108 | cv::cvtColor(_image1->toCvMat(), input1, CV_BGR2GRAY); |
| 109 | cv::cvtColor(_image2->toCvMat(), input2, CV_BGR2GRAY); |
| 110 | |
| 111 | std::stringstream s1; |
| 112 | s1 << "Number of Keypoints 1: "; |
| 113 | s1 << keypoints1.size(); |
| 114 | addInformation(s1.str()); |
| 115 | std::stringstream s2; |
| 116 | s2 << "Number of Keypoints 2: "; |
| 117 | s2 << keypoints2.size(); |
| 118 | addInformation(s2.str()); |
| 119 | |
| 120 | // computing descriptors |
| 121 | cv::Ptr<SURF> extractor = SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright); |
| 122 | cv::Mat descriptors1, descriptors2; |