2016-06-24 2 views
0

두 이미지 I-1과 I-2를 사용하여 im4java를 사용하여 두 이미지를 비교할 수있었습니다. 그러나 지금 I-1, I-2는 서로 다른 크기를 가지고 있으며, 그러므로 나는 그들을 비교하지 않는이 두 이미지를 비교 할 때와 메시지를im4java를 사용하여 서로 다른 크기의 이미지를 비교하는 방법

예 제공 : org.im4java.core.CommandException : org.im4java합니다. core.CommandException : compare.exe : 이미지 너비 또는 높이가 'C : \ Users \ hp \ workspace-getlinks-multipurpose \ links_extractor/snapshots/actuals/id-dashboard.jpg'@ error/compare.c/CompareImageCommand/990과 다릅니다.

다음

내 코드입니다 :

 public static boolean compareImages(String exp, String cur,String output) { 


    // This instance wraps the compare command 
    CompareCmd compare = new CompareCmd(); 

    // For metric-output 
    //compare.setErrorConsumer(StandardStream.STDERR); 

    IMOperation cmpOp = new IMOperation(); 
    // Set the compare metric 
    cmpOp.metric("mae"); 


// cmpOp.addSubOperation(subimageSearch()); 

    // Add the expected image 
    cmpOp.addImage(exp); 

    // Add the current image 
    cmpOp.addImage(cur); 

    // This stores the difference 
    cmpOp.addImage(output); 

    try { 
     // Do the compare 
     compare.run(cmpOp); 

     return true; 

    } catch (Exception ex) { 

     System.out.println("ex: "+ex); 

     return false; 

    } 
} 
+0

을 cmp.png -metric phash의 image2.png의 image1.png 비교 그리고 나는 imageMagik + cmd 프롬프트에서 사용할 수있는 subimage-search와 같은 것을 볼 수있다. ** compare -metric rmse -subimage-search image2.png image1.png cmp.png ** – Pawan

답변

0

Pawan의 외에 또 다른 옵션은 phash 메트릭을 사용하는 것입니다 : 내가 어떤 RND했을