Hello,
I am getting video from drone and I know georeference where to put this image on map.
I want to make ORTHOPHOTO MOSAIC from real time video.
So I need fast image stitching.
Below is my tested code.
Problem1: If I give multiple images in to stitcher it takes a lot of time to process it.
Problem2: If I always give to stitcher only 2 images (first one is already stitched from all previous images) I see that I am loosing quality on the image (all previous stitched images are blured)
Any suggestions how to do this?
Here is my code:
private void Update(int imgCount)
{
IEnumerable<Mat> images = SelectStitchingImages(imgCount);
Stitcher stitcher = Stitcher.Create(true);
stitcher.RegistrationResol = 0.2;
stitcher.WaveCorrection = false;
//stitcher.CompositingResol = -0.5; //default -1
//stitcher.PanoConfidenceThresh = 0.5; //default 1
//stitcher.RegistrationResol = 0.2; //default 0.6
//stitcher.SeamEstimationResol = 0.05; //default 0.1
//stitcher.WaveCorrection = false; //default true
Stitcher.Status status = stitcher.EstimateTransform(images);
if (status != Stitcher.Status.OK)
{
Console.WriteLine("Can't stitch images, error code = " + (int)status);
return;
}
var panoMat = new Mat();
Stitcher.Status status1 = stitcher.ComposePanorama(images, panoMat);
if (status1 != Stitcher.Status.OK)
{
Console.WriteLine("Can't stitch images, error code = " + (int)status1);
return;
}
stitcher.Dispose();
foreach (Mat mat in images)
mat.Dispose();
panoMat.SaveImage("c:\\Downloads\\Slike\\merged_Update_" + imgCount + ".JPG");
panoMat.Dispose();
}
private Mat[] SelectStitchingImages(int imgCount)
{
var mats = new List<Mat>();
string[] files = Directory.GetFiles("c:\\Downloads\\Slike\\", "DSC*.JPG", SearchOption.AllDirectories);
for (var i = 0; i < files.Length; i++)
{
Mat source = new Bitmap(files[i]).ToMat();
mats.Add(source);
if (i == imgCount)
{
//Console.WriteLine("Update files[" + i + "]: " + files[i]);
break;
}
}
return mats.ToArray();
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello, I am getting video from drone and I know georeference where to put this image on map. I want to make ORTHOPHOTO MOSAIC from real time video. So I need fast image stitching.
Below is my tested code. Problem1: If I give multiple images in to stitcher it takes a lot of time to process it. Problem2: If I always give to stitcher only 2 images (first one is already stitched from all previous images) I see that I am loosing quality on the image (all previous stitched images are blured)
Any suggestions how to do this?
Here is my code:
Something like example: https://github.com/zdzhaoyong/Map2DFusion