Ask Your Question

masehitam's profile - activity

2016-07-06 20:08:42 -0500 commented answer c++ to java

yes, I am using List<MatOfPoint>. but I need to calculate it's size

void MarkerDetector::findContours(const cv::Mat& thresholdImg,std::vector<std::vector<cv::Point>>& contours,int minContourPointsAllowed)
    std::vector< std::vector<cv::Point> > allContours;
    cv::findContours(thresholdImg, allContours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
    for (size_t i=0; i<allContours.size(); i++)
        int contourSize = allContours[i].size();
        if (contourSize > minContourPointsAllowed)
2016-07-06 09:05:28 -0500 asked a question c++ to java

I found source code in c++

std::vector< std::vector<cv::Point> > allContours;

how do I make it in java ?

2016-06-29 03:17:21 -0500 commented question How I detect marker using OpenCV for android

I'm sorry, I'm forget to translate in english

2016-06-29 03:16:47 -0500 received badge  Editor (source)
2016-06-29 03:13:53 -0500 asked a question How I detect marker using OpenCV for android

hi, recently I learned OpenCV for android to make the marker-based augmented reality applications, I found the book Android Application Programming with OpenCV 3 and there are cases where the application successfully seek green image and draw lines on the image. but when I tried to use markers like this, image description the application failed to find an image (not drawing a green line), how do I get an application can find pictures of the markers? here's the code :

public ImageDetectionFilter(final Context context,
        final int referenceImageResourceID) throws IOException {

    // Load the reference image from the app's resources.
    // It is loaded in BGR (blue, green, red) format.
    mReferenceImage = Utils.loadResource(context,

    // Create grayscale and RGBA versions of the reference image.
    final Mat referenceImageGray = new Mat();
    Imgproc.cvtColor(mReferenceImage, referenceImageGray,
    Imgproc.cvtColor(mReferenceImage, mReferenceImage,

    // Store the reference image's corner coordinates, in pixels.
    mReferenceCorners.put(0, 0,
            new double[] {0.0, 0.0});
    mReferenceCorners.put(1, 0,
            new double[] {referenceImageGray.cols(), 0.0});
    mReferenceCorners.put(2, 0,
            new double[] {referenceImageGray.cols(),
    mReferenceCorners.put(3, 0,
            new double[] {0.0, referenceImageGray.rows()});

    // Detect the reference features and compute their
    // descriptors.
            mReferenceKeypoints, mReferenceDescriptors);

public void apply(final Mat src, final Mat dst) {

    // Convert the scene to grayscale.
    Imgproc.cvtColor(src, mGraySrc, Imgproc.COLOR_RGBA2GRAY);

    // Detect the scene features, compute their descriptors,
    // and match the scene descriptors to reference descriptors.
    mFeatureDetector.detect(mGraySrc, mSceneKeypoints);
    mDescriptorExtractor.compute(mGraySrc, mSceneKeypoints,
            mReferenceDescriptors, mMatches);

    // Attempt to find the target image's corners in the scene.

    // If the corners have been found, draw an outline around the
    // target image.
    // Else, draw a thumbnail of the target image.
    draw(src, dst);

the full source code can be downloaded from here : here