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 task_sobel(original_path, result_path1, result_path2, result_path3): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_result1 = sobel.sobelOperator(pix_array)[0] pix_result2 = sobel.sobelOperator(pix_array)[1] pix_result3 = sobel.sobelOperator(pix_array)[2] utils.array_to_picture(pix_result1, IMAGES_RESULT + result_path1) utils.array_to_picture(pix_result2, IMAGES_RESULT + result_path2) utils.array_to_picture(pix_result3, IMAGES_RESULT + result_path3)
def task_smoothing(original_path, result_path, xor_path): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_smoothing = smoothing.conservative_smoothing_gray(pix_array, 2) utils.array_to_picture(pix_smoothing, IMAGES_RESULT + result_path) pix_xor = smoothing.xor(pix_array, pix_smoothing) utils.array_to_picture(pix_xor, IMAGES_RESULT + xor_path)
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)
def task_oversample_once(original_path, result_path, ratio): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_once = oversampling.once(pix_array, ratio) utils.array_to_picture(pix_once, IMAGES_RESULT + result_path)
def task_decimation(original_path, result_path, m): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_decimated = oversampling.decimation(pix_array, m) utils.array_to_picture(pix_decimated, IMAGES_RESULT + result_path)
def task_interpolation(original_path, result_path, n): pix_array = utils.picture_to_array(IMAGES_RESOURCE + original_path) pix_interpolated = oversampling.interpolation(pix_array, n) utils.array_to_picture(pix_interpolated, IMAGES_RESULT + result_path)