Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] How to Optimize Image Stitching #920

Open
bmurf17 opened this issue Mar 22, 2024 · 3 comments
Open

[QUESTION] How to Optimize Image Stitching #920

bmurf17 opened this issue Mar 22, 2024 · 3 comments
Assignees

Comments

@bmurf17
Copy link

bmurf17 commented Mar 22, 2024

Describe the Question
I am trying to to use Emgu CV to stitch together about a 1000 images at once. The images are all about the same size and the overlap is always the same percentage. I just have a few questions about how to tune the stitching to be as fast as possible. Because what I'm running is much too slow.

  1. Is there a way with Emgu 4.8 to tap in the GPU? with version 2.4 there is reference to using the GPU but now there is no constructor to offload this to the GPU.
  2. Is there a better Feature Finder for this type of work than the Brisk feature finder? This might just be a question for someone who is new to the image stitching world, but for images with consistent overlap that come across in a gird, it is hard to tell from the documentation if I should use Brisk vs AKAZE, vs MSER vs GFTT. I've played around with bench marking the other detectors but they don't seem to play with my images, and I'm trying to figure out if that's a problem with how I set them up or if they shouldn't be used for this workload.

OS / Platform
Windows

.Net version
e.g. .NetFramework 4.8, .Net Core 5, .Net 6, Xamarin Android, Xamarin iOS

Emgu CV package used
"Emgu.CV" Version="4.8.1.5350
"Emgu.CV.Bitmap" Version="4.8.1.5350"
"Emgu.CV.runtime.windows" Version="4.8.1.5350"

To Reproduce

Brisk detector = new Brisk();
using (Stitcher stitcher = new Stitcher())
using (Emgu.CV.Stitching.WarperCreator warper = new SphericalWarper())
{
    stitcher.SetFeaturesFinder(detector);
    stitcher.SetWarper(warper);
    using (VectorOfMat vm = new VectorOfMat())
    {
        Mat output = new Mat();
        vm.Push(images);
        var watch = System.Diagnostics.Stopwatch.StartNew();
        var status = stitcher.Stitch(images, output);
        watch.Stop();
        var elapsedMs = watch.ElapsedMilliseconds;
        if (status == Stitcher.Status.Ok)
        {
            pictureBox1.Image = output.ToBitmap();
            output.ToBitmap().Save("example output file");
        }
        else
        {
            //lblStatus.Text = "Failed to stitch.";
        }
    }
}

Additional context
Being new to image stitching I don't know if this is the wrong approach trying to stitch together that many images at once. I'll be running this in the cloud though so I will have a good chunk of compute to throw at this process. I just want to understand how the tool works a little bit before I start sinking compute into it.

@bmurf17
Copy link
Author

bmurf17 commented Mar 25, 2024

Making a comment here incase anyone else has similar questions, but I'm working through the docs here. I'll come back and update here if anything stands out. open cv docs

@bmurf17
Copy link
Author

bmurf17 commented Mar 26, 2024

I have found how to turn on the CPU using Cuda, but I'm still playing around with how to get Cuda to be optimized stitching. Such as how to get the GPU mats to stitch properly. Will update when I find how to do it.

@bmurf17
Copy link
Author

bmurf17 commented Mar 26, 2024

@emgucv Feel free to move this to discussion as well. I'm still digging in but figured out there is GPU stuff just not super clear in the documentation. Also if you could show an example of GPU stitching that would be appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants