# 需要导入模块: 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方法代码示例相关推荐

  1. python args keargs_Python metrics.silhouette_score方法代码示例

    本文整理汇总了Python中sklearn.metrics.silhouette_score方法的典型用法代码示例.如果您正苦于以下问题:Python metrics.silhouette_score ...

  2. python cv2 imwrite_Python cv2.imwrite方法代码示例

    本文整理汇总了Python中cv2.imwrite方法的典型用法代码示例.如果您正苦于以下问题:Python cv2.imwrite方法的具体用法?Python cv2.imwrite怎么用?Pyth ...

  3. doc python 颜色_Python wordcloud.ImageColorGenerator方法代码示例

    本文整理汇总了Python中wordcloud.ImageColorGenerator方法的典型用法代码示例.如果您正苦于以下问题:Python wordcloud.ImageColorGenerat ...

  4. python asyncio future_Python asyncio.isfuture方法代码示例

    本文整理汇总了Python中asyncio.isfuture方法的典型用法代码示例.如果您正苦于以下问题:Python asyncio.isfuture方法的具体用法?Python asyncio.i ...

  5. python operator __gt___Python operator.gt方法代码示例

    本文整理汇总了Python中operator.gt方法的典型用法代码示例.如果您正苦于以下问题:Python operator.gt方法的具体用法?Python operator.gt怎么用?Pyth ...

  6. python socket connection_Python socket.create_connection方法代码示例

    本文整理汇总了Python中gevent.socket.create_connection方法的典型用法代码示例.如果您正苦于以下问题:Python socket.create_connection方 ...

  7. python中shelf_Python cmds.shelfLayout方法代码示例

    本文整理汇总了Python中maya.cmds.shelfLayout方法的典型用法代码示例.如果您正苦于以下问题:Python cmds.shelfLayout方法的具体用法?Python cmds ...

  8. python中summary_Python summary_pb2.Summary方法代码示例

    本文整理汇总了Python中tensorflow.core.framework.summary_pb2.Summary方法的典型用法代码示例.如果您正苦于以下问题:Python summary_pb2 ...

  9. python cpu count_Python multiprocessing.cpu_count方法代码示例

    本文整理汇总了Python中multiprocessing.cpu_count方法的典型用法代码示例.如果您正苦于以下问题:Python multiprocessing.cpu_count方法的具体用 ...

  10. python socket send_Python socket.send方法代码示例

    本文整理汇总了Python中socket.send方法的典型用法代码示例.如果您正苦于以下问题:Python socket.send方法的具体用法?Python socket.send怎么用?Pyth ...

最新文章

  1. 强强联合!Papers with Code携手arXiv,上传论文、提交代码一步到位
  2. centos6.8 安装nginx
  3. 脑机互动可提高行动能力
  4. (自已看的东西)java通过get和post直接提交
  5. 安卓自定义View进阶-分类与流程
  6. python fromhex_Python hexstring-list-str之间的转换方法
  7. 做word计算机海报图片,使用word制作宣传海报
  8. JIRA带来的管理思路
  9. linux系统怎么拨号上网,在linux中如何拨号上网?
  10. 【图灵学院02】大型互联网技术之数据库分库分表
  11. 2020有道翻译 使用付费api
  12. Android Google Services Framework Google Play
  13. 《“人工智能”主题论坛》学习笔记(一)
  14. 科技无障碍盛会举办,人工智能和创新成为高频词
  15. 【科创人独家】阿拉丁史文禄:恐惧于确定的未来,小程序年内将迎来爆发
  16. SpringBoot中级
  17. 排球计分系统java_排球计分系统|网世技术排球计分系统下载v1.0官方版 - 欧普软件下载...
  18. 计算机控制系统直流电机闭环调速实验,4.14直流电机闭环调速实验.pdf
  19. Centos7:给/dev/mapper/cl-root分区扩容
  20. 分布式系统的容错性(二)——检错和纠错

热门文章

  1. jquery防止冒泡
  2. 看完就懂系列—动态规划
  3. HTML textarea标签属性
  4. Linux命令(27):shell 结合expect,多服务器批量分发数据
  5. 关于Advertising Campaign
  6. 在VirtualBox中的Ubuntu中添加新硬盘
  7. C语言及程序设计进阶例程-32 位运算及其应用
  8. crontab定时巡检使用
  9. zabbix之使用proxy实现分布式监控
  10. 解决foxmail提示“can not open socket WinSock Error:10106”