日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python cv release_Python cv.GetSize方法代码示例

發布時間:2025/5/22 python 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python cv release_Python cv.GetSize方法代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

# 需要導入模塊: import cv [as 別名]

# 或者: from cv import GetSize [as 別名]

def FPV_thread():

global camera_index

global capture

global WINDOW_NAME

global latest_frame

global FPV_thread_stop

global overlay_message # shared with application return results

global face_position # shared with application return results

FPV_init()

cv.NamedWindow(WINDOW_NAME, cv.CV_WINDOW_NORMAL)

cv.MoveWindow(WINDOW_NAME, 0, 0)

width_scale = 1.0

height_scale = 1.0

while True:

frame = cv.QueryFrame(capture)

cv.Flip(frame, None, 1)

#copy to buffer

frame_lock.acquire()

original_imagesize = (0,0)

resized_imagesize = (0,0)

if not latest_frame:

latest_frame = cv.CreateImage((640, 480), frame.depth, frame.nChannels)

original_imagesize = cv.GetSize(frame)

resized_imagesize = cv.GetSize(latest_frame)

width_scale = original_imagesize[0]*1.0/resized_imagesize[0]

height_scale = original_imagesize[1]*1.0/resized_imagesize[1]

cv.Resize(frame, latest_frame)

frame_lock.release()

#Display Result

text_start_point = (10, 50)

cv.PutText(frame, overlay_message, text_start_point, font, cv.Scalar(255,255,255))

cv.Rectangle(frame, text_start_point, (original_imagesize[0], 100), cv.Scalar(0,0,0), thickness=cv.CV_FILLED)

if face_position[0] > 0.0:

point1 = (int(face_position[0]*width_scale), int(face_position[1]*height_scale))

point2 = (int((face_position[0] + face_position[2])*width_scale), \

int((face_position[1]+face_position[3])*height_scale))

cv.Rectangle(frame, point1, point2, \

cv.Scalar(255, 255, 255), thickness=2)

cv.ShowImage(WINDOW_NAME, frame)

cv.ResizeWindow(WINDOW_NAME, 200, 100)

cv.NamedWindow(WINDOW_NAME, cv.CV_WINDOW_NORMAL);

cv.SetWindowProperty(WINDOW_NAME, 0, cv.CV_WINDOW_FULLSCREEN);

c = cv.WaitKey(10)

if c == ord('q'):

break

print "[INFO] FPV Thread is finished"

FPV_thread_stop = True

FPV_close()

總結

以上是生活随笔為你收集整理的python cv release_Python cv.GetSize方法代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。