Wyjątek podczas porównywania obrazu

0

Witam, porównuję obraz w następujący sposób

pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();// clone the bitmap
            Bitmap obrazzKlatek = (Bitmap)eventArgs.Frame.Clone();


            if (porownywanie == true)
            {
     
                ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);
                // compare two images
                TemplateMatch[] matchings = tm.ProcessImage(obrazWzorcowy, obrazzKlatek);
                // check similarity level
            }
 

i dostaje wyjątek taki

An exception of type 'AForge.Imaging.UnsupportedImageFormatException' occurred in AForge.Imaging.dll but was not handled in user code

Additional information: Unsupported pixel format of the source or template image. 

Nie mam pojęcia jak go naprawić

0

uzyj try i catch i zobacz co masz w expcetionie a w szczegolnosci w InnerException

try{
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();// clone the bitmap
            Bitmap obrazzKlatek = (Bitmap)eventArgs.Frame.Clone();
 
 
            if (porownywanie == true)
            {
 
                ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);
                // compare two images
                TemplateMatch[] matchings = tm.ProcessImage(obrazWzorcowy, obrazzKlatek);
                // check similarity level
            }
}
catch(Exception ex){}//tutaj debuguj i zobacz co ex zawiera 
0

Niestety w InnerException nie ma nic a w exc.message pisze Unsupported pixel format of the source or template image

0

witam, problem rozwiązałem używając filtra, już nie wyskakuje wyjątek

1 użytkowników online, w tym zalogowanych: 0, gości: 1