简体   繁体   中英

How to extract object orientation from video stream (Webcam) - Python

I found this guide which teaches how to refine the orientation of objects from images. I would love to know if it can and should be used to analyze the orientation of objects displayed in video streams.

The basis for the work is from the scientific publication found in this video . I want to know how they got information about the direction of the Fish's face.

在此处输入图像描述

Thanks , Avishai

You will probably need library like opencv to get orientation information from the image. You can apply threshold after converting this image to grayscale and extract contour of the image. After that you need to follow something like below pattern to get orientation. Very easy, just a little bit search you can find a lot of similar examples as well.

rectangle_for_angle = cv2.minAreaRect(cntrs[0])
angle = rectangle_for_angle[-1]
rect_points = cv2.boxPoints(rectangle_for_angle)
rect_points_result = np.int0(rect_points)
#You can also draw rotated image
cv2.drawContours(image,[rect_points_result],0,(0,0,255),2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM