create convexhull around detected keypoints
I read an image in android and detect the keypoints using sift algorithm, then I want to create Object of Interest (OOI) around these keypoints by creating a convex hull of the corresponding points How can I create this convexhull and draw it using findcontours ??? this is my code:
inputImage = BitmapFactory.decodeResource(getResources(), R.drawable.test);
Mat rgba = new Mat();
Mat rgbagray = new Mat(rgba.width(),rgba.height(),CV_8UC1);
Utils.bitmapToMat(inputImage, rgba);
Imgproc.cvtColor(rgba, rgbagray, Imgproc.COLOR_RGBA2GRAY);
MatOfKeyPoint keyPoints = new MatOfKeyPoint();
detector.detect(rgbagray, keyPoints);
List<MatOfPoint> contours = new ArrayList<>();
Mat hierarchy = new Mat();
List<KeyPoint> listpoint = new ArrayList<KeyPoint>();
listpoint = keyPoints.toList();
//
for (int ind = 0; ind < listpoint.size(); ind++) {
// find region of interest
}
hmm, there are no "Objects" found by keypoint detection, keypoints may be at arbitrary positions in the image, so your idea does not make much sense.
what are you trying to achieve with the whole feature detection ? (what's it going to be ?)
I try to follow this paper (Monocular Vision-Based Obstacle Detection/Avoidance for Unmanned Aerial Vehicles) to do obstacle detection, I worked with SIFT algorithm in order to detect the keypoints in both images (two consecutive frames), then the Brute-Force Algorithm to match them,. Then I should extract the keypoints that its keypoints are expanding in the second image, this is by comparing the size property of the keypoints and save it in a new vector of keypoints. Finally, I want to use the functions to create the the convex hull around the final keypoints after filtering, and drawing it using findContours function. How to do this?
ah, ok, then.
i do not have java around, so i can't give you a detailled answer (or even test it), but the gist would be:
I can not understand this point please more details : sadly it only has the indexed version (do you have to use java ?) so you need to look up the hull points using the indexes returned from your Point array
in c++ , there is an overload, that gives you the hull points directly (but it'snot available in java)
can you give me example for convex hull using java ?
I want to ask about find contours I take the input and output contours .. what will be the input in this case, will it be the MatOfpoint from keypoints list ??