2017-10-24 1 views
-2

이 내 코드입니다 :ExhaustiveTemplateMatching ProcessImage이 비어 반환

static void Main(string[] args) 
     { 
      ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0); 

      // Compare two images 
      System.Drawing.Bitmap image1 = new System.Drawing.Bitmap("2.jpg"); 
      System.Drawing.Bitmap image2 = new System.Drawing.Bitmap("2.jpg"); 
      TemplateMatch[] matchings = tm.ProcessImage(image1, image2); 
      MessageBox.Show(matchings[0].Similarity.ToString()); 
      // Check similarity level 
      if (matchings[0].Similarity > 0.95) 
      { 

      } 
     } 

attchment :

value and exception

value and exception

+0

[최소한의 완전하고 검증 가능한 예제를 만드는 방법] (https://stackoverflow.com/help/mcve)을 읽어보십시오. –

+0

@JohnEphraimTugado이 질문에 도움을 주시겠습니까? 감사합니다 –

+0

인덱스가 범위를 벗어나는 예외는 'matchings'에 요소가 포함되어 있지 않기 때문입니다. 원인을'TemplateMatch [] matchings = tm.ProcessImage (image1, image2);'에서 찾을 수 있습니다. 나는 여러분이 중단 점을 넣고 응용 프로그램을 디버깅하는 방법을 배우는 것이 좋습니다. 때때로 코딩의 실수로 응용 프로그램이 실패하는 것이 놀랍습니다. –

답변

0

최종 솔루션은 값 형식을 변경하는 클래스를 ExhaustiveTemplateMatching 다시 때문입니다 그림의 해상도가 너무 커서 int32 값이 충분하지 않습니다.

관련 문제