Emgu Cv How To Stitch with GPU

30 Views Asked by At

I'm trying to stitch together 1000 tiled images together to create one large image. I've been trying to use Emgu CV, but I just need to the process to run faster. So I'm trying to use the GPU capabilities I've been able to find in the documentation for both emgu and open cv, but I haven't gotten it to work. I've been trying to different approaches and neither have worked for me yet.

1st: I have tried stitching A Vector of GPU Mats. This ends up throwing an error though OpenCV: Unknown/unsupported array type

private GpuMat DoStichingWork(VectorOfGpuMat images)
{
    Brisk detector = new Brisk();
    using (Stitcher stitcher = new Stitcher(Stitcher.Mode.Panorama))
    using (WarperCreator warper = new SphericalWarperGpu())
    {
        stitcher.SetFeaturesFinder(detector);
        stitcher.SetWarper(warper);
        using (VectorOfGpuMat vm = new VectorOfGpuMat())
        {
            GpuMat output = new GpuMat();
            vm.Push(images);
            var status = stitcher.Stitch(vm, output);
            if (status == Stitcher.Status.Ok)
            {
                return output;
            }
            else
            {
                return null;
            }
        }
    }
}

2nd: I have tried to use run the code using a GPU wraper. This code works fine and does not throw any errors. I just does not activate my GPU so I don't save any time running it.

private Mat DoStichingWorkSimple(VectorOfMat images)
{
    Brisk detector = new Brisk();
    using (Stitcher stitcher = new Stitcher(Stitcher.Mode.Panorama))
    using (WarperCreator warper = new SphericalWarperGpu())
    {

        stitcher.SetFeaturesFinder(detector);
        stitcher.SetWarper(warper);
        using (VectorOfMat vm = new VectorOfMat())
        {
            Mat output = new Mat();
            vm.Push(images);
            var status = stitcher.Stitch(images, output);
            if (status == Stitcher.Status.Ok)
            {
                return output;
            }
            else
            {
                //lblStatus.Text = "Failed to stitch.";
                return null;
            }
        }
    }
}

I've been looking for a CUDA based stitch method in EMGU and haven't found one yet, and there doesn't seem to be any other straight forward way to do it using EMGU. If anyone know how to run the stitch in Emgu using the GPU that would be greatly appreciated. I know this is doable and seems more straight forward in python and c++, it would just work better for my project to use C#

nuget versions:
Emgu.CV: Version="4.7.0.5276"
Emgu.CV.Bitmap Version="4.7.0.5276"
Emgu.CV.runtime.windows.cuda Version="4.4.0.4099"

docs:
open cv stitcher class
emgu cv stitcher class
emgu cv cuda namespace

0

There are 0 best solutions below