Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def start_moments_calculator(self, target_algorithm, display=False):
- while True:
- processed_image = self.get_processed_image(target_algorithm)
- if processed_image is None:
- break
- moments = cv2.moments(processed_image)
- hu_moments = cv2.HuMoments(moments)
- for i in range(0, 7):
- hu_moments[i] = -1 * copysign(1.0, hu_moments[i]) * log10(abs(hu_moments[i]))
- if display:
- cv2.imshow("Show by CV2", processed_image)
- k = cv2.waitKey(1)
- if k % 256 == 27: # ESC
- print("Escape hit, closing...")
- break
- self.cam.release()
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement