Ask Your Question

Sap's profile - activity

2020-05-24 05:04:13 -0600 received badge  Popular Question (source)
2016-05-21 15:30:20 -0600 received badge  Student (source)
2016-04-03 16:41:11 -0600 commented question Object detection using edge matching on android

I used ORB for the detection. The items are kitchen objects such as fork, spoon, plate etc. I used edges because I need to ignore the background. I tried to do a regular matching and it doesn't work on different backgrounds or lighting conditions. Edges takes these factors out of the equation - that's why I tried it. Also, I tried to show the matches and for some reason nothing showed.

2016-04-03 14:52:46 -0600 asked a question Object detection using edge matching on android

Hello, I'm having some problem with finding objects in the camera frame using edges or contours (in order to dismiss the background of the object) in android platform, I've tried to find keypoints in the Canny results of both the template image and the frame, and then matching them, but it doesn't work as I expected.

Is there a better way of doing it? If not please help me figure out what I'm missing.

Applying Canny on the reference image and finding keypoints:

Imgproc.Canny(mReferenceImage, referenceImageGray, 80, 90);
    mFeatureDetector.detect(referenceImageGray,
            mReferenceKeypoints);
    mDescriptorExtractor.compute(referenceImageGray,
            mReferenceKeypoints, mReferenceDescriptors);

Applying Cany on the frame and matching:

Imgproc.Canny(src, mGraySrc, 80, 90);
    mFeatureDetector.detect(mGraySrc, mSceneKeypoints);
    mDescriptorExtractor.compute(mGraySrc, mSceneKeypoints,
            mSceneDescriptors);
    mDescriptorMatcher.match(mSceneDescriptors,
            mReferenceDescriptors, mMatches);

After that a function is called to find the corners of the object:

private void findSceneCorners() {

    final List<DMatch> matchesList = mMatches.toList();
    if (matchesList.size() < 4) {
        // There are too few matches to find the homography.
        return;
    }

    final List<KeyPoint> referenceKeypointsList =
            mReferenceKeypoints.toList();
    final List<KeyPoint> sceneKeypointsList =
            mSceneKeypoints.toList();

    // Calculate the max and min distances between keypoints.
    double maxDist = 0.0;
    double minDist = Double.MAX_VALUE;
    for (final DMatch match : matchesList) {
        final double dist = match.distance;
        if (dist < minDist) {
            minDist = dist;
        }
        if (dist > maxDist) {
            maxDist = dist;
        }
    }

    // The thresholds for minDist are chosen subjectively
    // based on testing. The unit is not related to pixel
    // distances; it is related to the number of failed tests
    // for similarity between the matched descriptors.
    if (minDist > 50.0) {
        // The target is completely lost.
        // Discard any previously found corners.
        mSceneCorners.create(0, 0, mSceneCorners.type());
        return;
    } else if (minDist >= 25.0) {
        // The target is lost but maybe it is still close.
        // Keep any previously found corners.
        return;
    }

    // Identify "good" keypoints based on match distance.
    final ArrayList<Point> goodReferencePointsList =
            new ArrayList<Point>();
    final ArrayList<Point> goodScenePointsList =
            new ArrayList<Point>();
    final double maxGoodMatchDist = 1.75 * minDist;
    for (final DMatch match : matchesList) {
        if (match.distance < maxGoodMatchDist) {
           goodReferencePointsList.add(
                   referenceKeypointsList.get(match.trainIdx).pt);
           goodScenePointsList.add(
                   sceneKeypointsList.get(match.queryIdx).pt);
        }
    }

    if (goodReferencePointsList.size() < 4 ||
            goodScenePointsList.size() < 4) {
        // There are too few good points to find the homography.
        return;
    }

    // There are enough good points to find the homography.
    // (Otherwise, the method would have already returned.)

    // Convert the matched points to MatOfPoint2f format, as
    // required by the Calib3d.findHomography function.
    final MatOfPoint2f goodReferencePoints = new MatOfPoint2f();
    goodReferencePoints.fromList(goodReferencePointsList);
    final MatOfPoint2f goodScenePoints = new MatOfPoint2f();
    goodScenePoints.fromList(goodScenePointsList);

    // Find the homography.
    final Mat homography = Calib3d.findHomography(
            goodReferencePoints, goodScenePoints);

    // Use the homography to project the reference corner
    // coordinates into scene coordinates.
    Core.perspectiveTransform(mReferenceCorners,
            mCandidateSceneCorners, homography);

    // Convert the scene corners to integer format, as required
    // by the Imgproc.isContourConvex function.
    mCandidateSceneCorners.convertTo(mIntSceneCorners,
            CvType.CV_32S);

    // Check whether the corners form a convex polygon. If not,
    // (that is, if the corners form a concave polygon), the
    // detection result is invalid because no real perspective can
    // make the corners of a rectangular image look like a concave
    // polygon!

   if (Imgproc.isContourConvex(mIntSceneCorners)) {
        // The corners form a convex polygon, so ...
(more)
2016-02-15 14:03:49 -0600 received badge  Enthusiast
2016-02-11 12:00:58 -0600 commented question Effective multiple object detection with a small data set

Hi, thanks for your quick response.

In my dattabase I keep the name of the object with it's images, so connecting between an image and it's name is an easy task. I thought that detection might be easier to perform, and thats why I wrote detection instide of recognition. As for the accuracy, I need it to be as high as possible on any object in the kitchen. Do you think Bag of Words is the best method to use here? Thanks again!

2016-02-11 07:43:36 -0600 asked a question Effective multiple object detection with a small data set

Hello,

I want to detect objects according to images from a database filled by the user, with a maximum amount of 6 images(for 6 different angles).

This amount is not enough for building a classifier, but I still need to be able to detect the objects in different backgrounds, different light conditions etc, in real time.

I also need to detect multiple objects in every frame and be able to find a relation between the detected objects (for example: Cup on Table).

How can I perform this kind of detection when I only have a small data set that I can't control? How sould I apply it on the other objects without increasing the response time? And How could I recognize the relation between them?

Thank you.