def show_detected_face(result, detected, title = "Detected Faces"): plt.imshow(result) img_desc=plt.gca() plt.set_cmap('gray') plt.title(title) plt.axis('off') for patch in detected: img_desc.add_patch( Rectangle( (patch['c'], patch['r']) patch['width'], patch['height'], fill = False, color = 'g', line_width = 3 ) ) plt.show()
def fd(): from skimage.feature import Cascade from skimage import data, color import matplotib.pyplot as plt from matplotlib.patches import Rectangle path = '' img = plt.imread(path) plt.axis('off') plt.imshow(img) train_set = data.lbp_frontal_face_cascade_filename() detector = Cascade(train_set) detected = detector.detect_multi_scale(img=img, scale_factor=1.2, step_ratio=1, min_size=(10, 10), max_size=(200, 200)) print('Detected') def show_detected_face(result, detected, title="Detected Faces"): plt.imshow(result) img_desc = plt.gca() plt.set_cmap('gray') plt.title(title) plt.axis('off') for rec in detected: img_desc.add_patch( Rectangle((rec['c'], rec['r']), rec['width'], rec['height'], fill=False, color='g', line_width=3)) plt.show() show_detected_face(img, detected)
image = cv2.imread(os.path.join(folder, filename)) if (image is not None): images.append(image) return images def to_gray(image): return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) originPath = "" targetFolder = "" targetImages = load_images_from_folder(targetFolder) originImage = cv2.imread(originPath) MAX = 2**8 - 1 for i in range(0, len(targetImages)): plt.imshow(to_gray(targetImages[i])) plt.show() mse = compare_mse(originImage, targetImages[i]) print("mse:{}", format(mse)) psnr = compare_psnr(originImage, targetImages[i]) print("msnr:{}", format(psnr)) ssim = compare_ssim(originImage, targetImages[i]) print("psnr:{}", format(ssim))
plt.hist(df['deep learning'], bins=15) plt.show() #siempre se pone al final plt.clf() #y eso para limpiar la grafica. Poner antes de hacer otra column_list2 = ['Temperature (deg F)','Dew Point (deg F)'] df[column_list2].plot() #plotear solo algunas columnas, guardadas como una lista en column_list2 plt.xscale('log') #eje x logaritmico plt.xlabel('xlab') plt.ylabel('ylab') plt.title('title') tick_val = [1000, 10000, 100000] #ticks donde se pone el tick lab tick_lab = ['1k', '10k', '100k'] plt.xticks(tick_val, tick_lab) plt.xlim(20, 55) plt.ylim(20, 55) plt.text(1550, 71, 'India') plt.text(5700, 80, 'China') plt.grid(True) plt.hist(life_exp, bins = 5) #histogramas plt.imshow(im_sq, cmap='Greys', interpolation='nearest') #una imagen de 28*28 pixels plt.show() df['Existing Zoning Sqft'].plot(kind='scatter', x='Year', y='Total Urban Population') #kind="hist", "box", logx=True, logy=True df.boxplot(column="initial_cost", by="Borough", rot=90)
from skimage.feature import Cascade from skimage import data, color import matplotib.pyplot as plt from matplotlib.patches import Rectangle path='' img = plt.imread(path) plt.axis('off') plt.imshow(img) train_set = data.lbp_frontal_face_cascade_filename() detector = Cascade(train_set) detected = detector.detect_multi_scale(img=img, scale_factor = 1.2, step_ratio = 1, min_size = (10,10), max_size = (200,200)) print('Detected') def show_detected_face(result, detected, title = "Detected Faces"): plt.imshow(result) img_desc=plt.gca() plt.set_cmap('gray') plt.title(title) plt.axis('off') for patch in detected: img_desc.add_patch( Rectangle( (patch['c'], patch['r']) patch['width'], patch['height'], fill = False, color = 'g', line_width = 3 ) ) plt.show()