2016-12-01 119 views

回答

0

嘗試使用圖像數組。 這不是你的解決方案,但這裏有一個例子:

from PIL import Image 
import numpy as np 

book_a = Image.open('booka.png') 
book_b = Image.open('bookb.png') 

#Which image do you like to compare? 
input = book_b #book_a of book_b 

print('*** Numpy array Book A') 

book_a_ar = np.asarray(book_a) 
print(book_a_ar) 

print('*** Numpy array Book B') 

book_b_ar = np.asarray(book_b) 
print(book_b_ar) 

#BOOK C is in use to compare those images 

print('*** Numpy array Book C') 
book_C_ar = np.asarray(input) 
print(book_C_ar) 

#compare 

if np.all(book_b_ar == book_C_ar): 
    print('True') 

else: 
    print('False') 

在這也看一看:Microcontrollers