查看“MicroMV 人脸识别”的源代码
←
MicroMV 人脸识别
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=='''基本原理'''== *MicroMV捕捉人脸得到人脸坐标 =='''MicroMV的代码准备'''== <source lang="py"> # Face Detection Example # # This example shows off the built-in face detection feature of the OpenMV Cam. # # Face detection works by using the Haar Cascade feature detector on an image. A # Haar Cascade is a series of simple area contrasts checks. For the built-in # frontalface detector there are 25 stages of checks with each stage having # hundreds of checks a piece. Haar Cascades run fast because later stages are # only evaluated if previous stages pass. Additionally, your OpenMV Cam uses # a data structure called the integral image to quickly execute each area # contrast check in constant time (the reason for feature detection being # grayscale only is because of the space requirment for the integral image). import sensor, time, image # Reset sensor sensor.reset() # Sensor settings sensor.set_contrast(1) sensor.set_gainceiling(16) # HQVGA and GRAYSCALE are the best for face tracking. sensor.set_framesize(sensor.HQVGA) sensor.set_pixformat(sensor.GRAYSCALE) # Load Haar Cascade # By default this will use all stages, lower satges is faster but less accurate. face_cascade = image.HaarCascade("frontalface", stages=25) print(face_cascade) # FPS clock clock = time.clock() while (True): clock.tick() # Capture snapshot img = sensor.snapshot() # Find objects. # Note: Lower scale factor scales-down the image more and detects smaller objects. # Higher threshold results in a higher detection rate, with more false positives. objects = img.find_features(face_cascade, threshold=0.75, scale_factor=1.25) # Draw objects for r in objects: img.draw_rectangle(r) # Print FPS. # Note: Actual FPS is higher, streaming the FB makes it slower. print(clock.fps()) </source> 效果如下: [[File:microMVGettingStart8.png||600px|center]] [[MicroMV 简介|返回MicroMV目录页面]]
返回至
MicroMV 人脸识别
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息