Compare Extention Method를 호출 할 때 AForge.Imaging
, i am getting Template's size should be smaller or equal to source image's size
을 사용하여 2 개의 비트 맵을 비교하려고합니다.AForge 이미지 비교
public static Boolean Compare(this Bitmap image1, Bitmap image2, double comparisionLevel, float threshold)
{
return new ExhaustiveTemplateMatching(threshold)
.ProcessImage(image1.To24bppRgbFormat(), image2.To24bppRgbFormat())[0]
.Similarity >= comparisionLevel;
}
public static Bitmap To24bppRgbFormat(this Bitmap img)
{
return img.Clone(new Rectangle(0, 0, img.Width, img.Height),
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
}
내가 무엇이 누락 되었습니까?
나는 그것이 오류를 일으키는 것처럼 보이는 offhand를 보지 않고있다. 확장 방법이 오류의 원인인지 확인 하시겠습니까? 확장 메소드가 잘 작동하고있을 가능성이 있지만 'ProcessImage'는 전달 된 값을 좋아하지 않습니다. 'img.Clone'의 결과를 지역 변수로 설정 한 다음 반환하고 응용 프로그램 디버깅을 시도하는 것이 좋습니다. 'To24bppRgbFormat'가 예외를 throw하지 않으면 실제로 반환하는 값을 볼 수 있으며 문제를 해결하는 데 도움이됩니다. –