Content

Board ID 1097
Writer 허진경
Write Date 2022-03-09 00:58:49
Subject Python ImagePreprocessor 클래스 image_process.py
Content Python ImagePreprocessor 클래스 사용법 ip = ImagePreprocessor(p=1.0) bboxes = np.array([ [380,129,408,157], [162,221,218,277], [290,232,332,274], [193,298,249,354], [167,97,279,209] ]) print("원본\n", bboxes) image = cv2.imread("mnist_sample.jpg") translate, bboxes = ip.random_translate(image, bboxes) print("이동\n", bboxes) flip, bboxes = ip.random_horizontal_flip(image, bboxes) print("좌/우 반전\n", bboxes) crop, bboxes = ip.random_crop(image, bboxes) print("자르기\n", bboxes) cv2.imshow("image", np.hstack([image, translate, flip])) cv2.imshow("crop", crop) cv2.waitKey() cv2.destroyAllWindows()
File image_process.py (2,894byte)