내용

글번호 1097
작성자 허진경
작성일 2023-10-26 09:25:03
제목 Python ImagePreprocessor 클래스 image_process.py
내용 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()
첨부파일 image_process.py (2,894byte)