Esempio n. 1
0
def main():
    filename = "../data/img/fingerprint.png"
    img = np.empty((2, 2))
    if cv2.os.path.exists(filename):
        img = image_processing.load_image_grayscale(filename)
    else:
        print("file does not exist")
        exit(1)
    result_img = Optimal_pattern(img)
    image_processing.image_show(result_img)
    young_pattern_hist(result_img)
def main():
    # sample code
    filename = "../data/img/fingerprint.png"
    img = np.empty((2, 2))
    if cv2.os.path.exists(filename):
        img = image_processing.load_image_grayscale(filename)
    else:
        print("file does not exist")
        exit(1)
    YP = Young_Finger(3, 6, 16.0, -5.0)
    YP.load_ndarray(img)
    YP.far_generation(10)
    YP.show()
def main():
    filename = "../data/img/fingerprint.png"
    img = np.empty((2, 2))
    if cv2.os.path.exists(filename):
        img = image_processing.load_image_grayscale(filename)
    else:
        print("file does not exist")
        exit(1)
    trimed = trim(img, 0.05, 0.9, 0.1, 0.9, True)
    magnify = 10 / 8
    resize_img = cv2.resize(trimed, dsize=None, fx=magnify, fy=magnify)
    young = Young_Finger(3, 6, 15, -5)
    young.load_ndarray(resize_img)
    gif_maker(young, generation=5, duration=1000)
# get_radius_listをscan_line_pairs回行って、幅の最頻値を求める
# thined_img: 2次元配列(細線化済み)
# scan_line_pairs: 整数(この値の2倍の線について幅を確認する)
# 返り値: 数値(幅)
def get_width(thined_img, scan_line_pairs=1, *, debug=False):
    height, width = thined_img.shape
    radius_list = []
    for i in range(scan_line_pairs):
        radius_list += get_radius_list(thined_img, [
            int(width / (scan_line_pairs + 1) * (i + 1)),
            int(height / (scan_line_pairs + 1) * (i + 1))
        ],
                                       debug=debug)
    if debug:
        # histogram
        make_hist(radius_list)
    return collections.Counter(radius_list).most_common()[0][0]


if __name__ == '__main__':
    img = image_processing.load_image_grayscale("../data/img/fingerprint.png")
    img = image_processing.blur(img)
    img = image_processing.threshold(img)
    img = image_processing.bitwise_not(img)
    img = image_processing.morphological_transformations(img)
    img = image_processing.thinning(img)
    image_processing.image_save(img, title="sample")
    width = get_width(img, debug=True)
    print("最頻値(幅): " + str(width))
Esempio n. 5
0
import cv2
import numpy as np

from edit_img import image_processing
from optimise.Optimal_pattern import Optimal_pattern
import sys

print("animal")
print(sys.path)

for i in range(1, 5):
    filename = "../data/img_animal/animal0{0}.jpg".format(i)
    print(filename)
    img = np.empty((2, 2))
    if cv2.os.path.exists(filename):
        img = image_processing.load_image_grayscale(filename)
    else:
        print("file does not exist")
        exit(1)
    result_img = Optimal_pattern(img)
    image_processing.image_show(result_img)