Click here to Skip to main content
16,015,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 17-Jun-18 23:45pm

1 solution

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.

C#
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;
}
 
Share this answer
 
Comments
R. B. Krish 18-Jun-18 6:14am    
Hi John Simmons, thanks for the reply, but I think this just merges two image into one. But I wanna detect similar points between two images, then stitch and blend them automatically.
#realJSOP 18-Jun-18 7:32am    
It should still be a reasonably simple process. Nobody here is going to be able to give you all the code you need. It would be an interesting app to write to allow the user to visually stitch images together.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900