16位灰度图像上的图像拼接 [英] Image stitching on 16 bit grayscale image

查看:189
本文介绍了16位灰度图像上的图像拼接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用c#缝合16位灰度x射线图像。



为什么我会问这个问题?


因为我遇到了一些开源库。我认为一切似乎都不支持16位灰度图像。



我尝试了什么:



到目前为止,我试图探索像EMGU-CV和Aforge(Accord)这样的图书馆。两者都具有不使用16位灰度图像的相同缺点。我没有编写新算法来制作图像拼接的经验。



所以请指导我任何图书馆或建议我任何代码,以帮助我片段。

Is there a way to stitch 16 bit grayscale xray images in c#.

Why am I asking this question?

Because I came across some open-source libraries. I think everything seems to be not supporting 16-bit grayscale images.

What I have tried:

I have so far tried to explore libraries like EMGU-CV and Aforge(Accord). Both has the same disadvantages of not using the 16 bit grayscale images. I don't have experience in writing a new algorithm to make image stitching.

So please help me any way possible by directing me towards any libraries or suggesting me any code snippets.

推荐答案

为什么需要第三方库来执行此操作?我通过谷歌搜索找到了这个代码,将第二张图像拼接到原始图像上的方向/位置更加通用是一件简单的事情。



Why do you need a 3rd party library to do this? I found this code with a google search, and it would be a simple matter to extend it to be more versatile with regards to which direction/position a 2nd image is to be stitched onto the original image.

private Bitmap MergeImages(IEnumerable<Bitmap> images)
{
    var enumerable = images as IList<Bitmap> ?? images.ToList();
    var width = 0;
    var height = 0;

    foreach (var image in enumerable)
    {
        width += image.Width;
        height = image.Height > height ? image.Height : height;
    }

    var bitmap = new Bitmap(width, height);
    using (var g = Graphics.FromImage(bitmap))
    {
        var localWidth = 0;
        foreach (var image in enumerable)
        {
            g.DrawImage(image, localWidth, 0);
            localWidth += image.Width;
        }
    }
    return bitmap;
}


这篇关于16位灰度图像上的图像拼接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆