Click here to Skip to main content
15,666,033 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I can display the stiched image to Result_img Object

I got this Error
CS0029 Cannot implicitly convert type 'System.Drawing.Bitmap' to 'System.Windows.Media.Imaging.BitmapImage'

What I have tried:

private void Generate_btn_Click(object sender, RoutedEventArgs e)
            Brisk detector = new Brisk();
            WarperCreator warper = new SphericalWarper();

            Stitcher stitcher = new Stitcher();
            Mat outputImage = new Mat();
            var status = stitcher.Stitch(imagesList, outputImage);
            if (status == Stitcher.Status.Ok)
                BitmapImage img = outputImage.ToBitmap();
                Result_img.Source = logo;

Updated 9-Aug-22 9:09am
Dave Kreskowiak 9-Aug-22 11:32am    
You forgot to detail what problem you're having, any error messages, what library you're using to generate the image, yada, yada, yada.

Basically, all you did was come here to rant about a problem, not describe one.
Hải Bằng Hoàng 9-Aug-22 12:18pm    
I got this Error
CS0029 Cannot implicitly convert type 'System.Drawing.Bitmap' to 'System.Windows.Media.Imaging.BitmapImage'
0x01AA 9-Aug-22 12:32pm    
I think you need to save System.Drawing.Bitmap into a memory stream and load System.Windows.Media.Imaging.BitmapImage from that stream.

When you get such an error you should go to the documentation for the two classes to understand why you cannot use a simple cast.
Bitmap Class (System.Drawing) | Microsoft Docs[^]
BitmapImage Class (System.Windows.Media.Imaging) | Microsoft Docs[^]
Share this answer

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