Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6842249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:04:36+00:00 2026-05-27T00:04:36+00:00

Hi have already function solution but one issue: // The screenshot will be stored

  • 0

Hi have already function solution but one issue:

            // The screenshot will be stored in this bitmap.
            Bitmap capture = new Bitmap(rec.Width, rec.Height, PixelFormat.Format24bppRgb);
            using (Graphics g = Graphics.FromImage(capture))
            {
                g.CopyFromScreen(rec.Location, new System.Drawing.Point(0, 0), rec.Size);
            }

            MCvSURFParams surfParam = new MCvSURFParams(500, false);
            SURFDetector surfDetector = new SURFDetector(surfParam);

            // Template image 
            Image<Gray, Byte> modelImage = new Image<Gray, byte>("template.jpg");
            // Extract features from the object image
            ImageFeature[] modelFeatures = surfDetector.DetectFeatures(modelImage, null);

            // Prepare current frame
            Image<Gray, Byte> observedImage = new Image<Gray, byte>(capture);
            ImageFeature[] imageFeatures = surfDetector.DetectFeatures(observedImage, null);


            // Create a SURF Tracker using k-d Tree
            Features2DTracker tracker = new Features2DTracker(modelFeatures);

            Features2DTracker.MatchedImageFeature[] matchedFeatures = tracker.MatchFeature(imageFeatures, 2);
            matchedFeatures = Features2DTracker.VoteForUniqueness(matchedFeatures, 0.8);
            matchedFeatures = Features2DTracker.VoteForSizeAndOrientation(matchedFeatures, 1.5, 20);
            HomographyMatrix homography = Features2DTracker.GetHomographyMatrixFromMatchedFeatures(matchedFeatures);

            // Merge the object image and the observed image into one image for display
            Image<Gray, Byte> res = modelImage.ConcateVertical(observedImage);

            #region draw lines between the matched features

            foreach (Features2DTracker.MatchedImageFeature matchedFeature in matchedFeatures)
            {
                PointF p = matchedFeature.ObservedFeature.KeyPoint.Point;
                p.Y += modelImage.Height;
                res.Draw(new LineSegment2DF(matchedFeature.SimilarFeatures[0].Feature.KeyPoint.Point, p), new Gray(0), 1);
            }

            #endregion

            #region draw the project region on the image

            if (homography != null)
            {
                // draw a rectangle along the projected model
                Rectangle rect = modelImage.ROI;
                PointF[] pts = new PointF[] { 
                    new PointF(rect.Left, rect.Bottom),
                    new PointF(rect.Right, rect.Bottom),
                    new PointF(rect.Right, rect.Top),
                    new PointF(rect.Left, rect.Top)
                };

                homography.ProjectPoints(pts);

                for (int i = 0; i < pts.Length; i++)
                    pts[i].Y += modelImage.Height;

                res.DrawPolyline(Array.ConvertAll<PointF, Point>(pts, Point.Round), true, new Gray(255.0), 2);
            }

            #endregion

            pictureBoxScreen.Image = res.ToBitmap();

the result is:

enter image description here

And my problem is that, function homography.ProjectPoints(pts);
Get only first occurrence of pattern (white rectangle in pic above)

How i can Project all occurrence of template, respectively how I can get occurrence of template rectangle in image

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:04:36+00:00Added an answer on May 27, 2026 at 12:04 am

    I face a problem similar to yours in my master thesis. Basically you have two options:

    1. Use a clustering such as Hierarchical k-means or a point density one such as DBSCAN (it depends on two parameters but you can make it threshold free in bidimensional R^2 space)
    2. Use a multiple robust model fitting estimation techniques such as JLinkage. In this more advanced technique you clusters points that share an homography instead of cluster points that close to each other in euclidean space.

    Once you partition your matches in “clusters” you can estimate homographies between matches belonging to correspondant clusters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already have a solution for this problem but I do not understand why
I have a jQuery function already to perform the task I need but is
I have already posted a question about this, but the situation has changed sufficiently
I have already posted something similar here but I would like to ask the
I have already googled for this I have a Table with following structure in
I have already created a webpart to show the data from list, but I
I have already have this code to force these URLs to HTTPS: RewriteCond %{HTTPS}
My issue is simple. I have already implemented a tab system, and I'd probably
This looks like a very simple issue, but I just can't get it to
It's mentioned in http://sourceware.org/ml/gdb/2007-06/msg00360.html before. But no one seemed to have actually implemented this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.