def drawMap(Map, angle, transformed_img, contours): grayMap = cv2.cvtColor(Map, cv2.COLOR_BGR2GRAY) rotated = rotate(grayMap, angle) x3, y3 = temp_match(rotated, transformed_img) Map1 = rotate(Map, angle) for cnt in contours: x,y,w,h = cv2.boundingRect(cnt) Map1 = cv2.rectangle(Map1, (x3+x-10,y3+y-10), (x3+x+10+w,y3+y+10+h), (0,0,0), 3) Map1 = rotate(Map1, -angle) Map1 = crop(grayMap, Map1) return Map1
def on_effect(self, event): """ Apply the specified effect to the image """ if not self.current_image: return tmp = os.path.join(self.std_paths.GetTempDir(), "temp.jpg") effect = self.effects_combo.GetValue() if "Rotate" in effect: degrees = int(effect.split()[-1]) rotate(self.original_image, degrees, tmp) self.current_image = tmp elif effect == "Mirror": mirror(self.original_image, tmp) self.current_image = tmp else: self.current_image = self.original_image self.load_image()
def apply_rotate(image_file, effect): if effect == "Rotate 90": rotate(image_file, 90, tmp_file) elif effect == "Rotate 180": rotate(image_file, 180, tmp_file) elif effect == "Rotate 270": rotate(image_file, 270, tmp_file)
opt = input("Do you want to save changes(y/n): ") if opt == 'y': save_img(image_name, original, image) print("Thank you!\nExiting..") break elif choice == 1: new = resize_image(image) elif choice == 2: new = blur(image, blur) elif choice == 3: new = image pass elif choice == 4: new = to_gray(image) elif choice == 5: new = rotate(image) elif choice == 6: new = edges(image) elif choice == 7: new = fuse_image(image) elif choice == 8: new = shape(image) elif choice == 9: new = crop_img(image) elif choice == 20: save_img(image_name, original, image) else: print("Invalid Choice") if choice in range(10):