def texture(sample_path, result_path): pix = u.picture_to_array(IMAGES_RESOURCE + sample_path) pix_semitone = semitone.semitone(pix) u.array_to_picture(pix_semitone, IMAGES_RESULT + result_path + "semitone.png") co_occurrence_matrix = t.get_co_occurrence_matrix(pix_semitone) spread_image = t.norm_matrix(co_occurrence_matrix) dis_i = t.dispersion(spread_image, 0) dis_j = t.dispersion(spread_image, 1) save_to_txt(dis_i, dis_j, IMAGES_RESULT + result_path + "features.txt") u.array_to_picture(spread_image, IMAGES_RESULT + result_path + "visualized.png")
def get_normalized_image(pix): img_binary = binary.apply_threshold(semitone.semitone(pix), 128, 1) return u.pix_invert(img_binary, 0)
def get_normalized_image(pix): img_grayscale = binary.apply_threshold(semitone.semitone(pix), 128, 1) return utils.pix_invert(img_grayscale, 0)
def task_threshold(sample_path, result_path): pix_array = utils.picture_to_array(IMAGES_RESOURCE + sample_path) semitone_arr = semitone.semitone(pix_array) threshold = binarization.bernsen_threshold(semitone_arr) pix_threshold = binarization.apply_threshold(semitone_arr, threshold) utils.array_to_picture(pix_threshold, IMAGES_RESULT + result_path)
def task_semitone(original_path, result_path): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_semitone = semitone.semitone(pix_array) utils.array_to_picture(pix_semitone, IMAGES_RESULT + result_path)