Ask Your Question

Revision history [back]

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

        }
click to hide/show revision 2
retagged

updated 2017-04-15 00:48:02 -0600

berak gravatar image

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

        }