<\/path> \n<\/svg> <\/p>\n1\u3001\u5f00\u7bb1<\/p>\n
Zora P1\u5f00\u53d1\u677f\u7684\u5305\u88c5\u8fd8\u662f\u5f88\u7cbe\u81f4\u7684\uff0c\u9664\u4e86\u5f00\u53d1\u677f\uff0c\u8fd8\u5e26\u4e86\u4e00\u4e2a\u7535\u6e90\u9002\u914d\u5668\u548c\u56fa\u5b9a\u5f00\u53d1\u677f\u7684\u4e9a\u514b\u529b\u677f\u914d\u4ef6\u3002
\u52a0\u4e0a\u54b8\u9c7c\u6dd8\u7684\u5965\u6bd4Astra\u6df1\u5ea6\u76f8\u673a\uff0c\u6211\u5c31\u5f00\u542f\u4e86\u8bc4\u6d4b\u4e4b\u65c5~\uff0c\u6df1\u5ea6\u76f8\u673a\u957f\u8fd9\u6837\u5b50\uff0c\u5b83\u9664\u4e86\u53ef\u4ee5\u8f93\u51faRGB\u56fe\u50cf\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u8f93\u51fa\u6df1\u5ea6\u56fe\uff0c\u56e0\u6b64\u53c8\u88ab\u53eb\u505aRGB-D\u76f8\u673a\u3002
2\u3001\u5b89\u88c5ubuntu\u7cfb\u7edf\uff0c\u7136\u540e\u5b89\u88c5Astra SDK\u548copenNI<\/p>\n
Zora P1\u5f00\u53d1\u677f\u81ea\u5e26\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e3aarmbian\u7cfb\u7edf\uff0c\u56e0\u4e3a\u4e4b\u524d\u7528\u6811\u8393\u6d3e\u6bd4\u8f83\u591a\uff0c\u6240\u4ee5\u5bf9raspian\u7cfb\u7edf\u6bd4\u8f83\u719f\u6089\uff0carmbian\u5176\u5b9e\u8ddf\u6811\u8393\u6d3e\u81ea\u5e26\u7684Raspian\u7cfb\u7edf\u5f88\u50cf\u3002
\u53e6\u5916\uff0cZora P1\u5f00\u53d1\u677f\u662farm\u67b6\u6784\u7684\uff0c\u56e0\u6b64\uff0c\u5728\u4e0b\u8f7dSDK\u548c\u5404\u79cd\u8f6f\u4ef6\u7684\u7248\u672c\u7684\u65f6\u5019\u8981\u6ce8\u610f\u9009\u62e9Linux Arm64\u7248\u672c\u7684\u3002<\/p>\n
3\u3001\u4eba\u8138\u8bc6\u522b\uff0c\u533a\u5206\u51fa\u662f\u4eba\u8138\u56fe\u7247\u8fd8\u662f\u771f\u4eba<\/p>\n
\u4e8e\u4e8c\u7ef4\u56fe\u50cf\u6765\u8bf4\uff0c\u8981\u60f3\u533a\u5206\u51fa\u771f\u4eba\u8fd8\u662f\u4eba\u8138\u56fe\u7247\u6709\u5f88\u5927\u7684\u96be\u5ea6\uff0c\u51c6\u786e\u6027\u96be\u4ee5\u4fdd\u8bc1\uff0c\u4e4b\u524d\u5c31\u6709\u62ff\u4eba\u8138\u56fe\u7247\u5237\u5f00\u5feb\u9012\u67dc\u7684\u65b0\u95fb\u51fa\u73b0\u3002\u800c\u6df1\u5ea6\u76f8\u673a\u53ef\u4ee5\u5f88\u8f7b\u6613\u5730\u8ba9\u4eba\u8138\u56fe\u7247\u73b0\u51fa\u539f\u5f62\uff0c\u51c6\u786e\u6027\u6709\u53ef\u9760\u4fdd\u8bc1\uff0c\u5bf9\u4e8e\u5b89\u9632\u3001\u91d1\u878d\u652f\u4ed8\u8fd9\u4e9b\u5e94\u7528\u573a\u666f\u6765\u8bf4\uff0c\u6df1\u5ea6\u76f8\u673a\u6709\u91cd\u8981\u7684\u5e94\u7528\u4ef7\u503c\u3002<\/p>\n
\u4eba\u8138\u8bc6\u522b\u662f\u57fa\u4e8epython\u548cOpenCV\u5f00\u53d1\u7684\uff0c\u8fc7\u7a0b\u5982\u6d41\u7a0b\u56fe\u6240\u793a\uff0c\u7528\u5230\u4e86openCV\u4e2d\u7684Haar CascadeClassifier\uff0c\u4e5f\u5c31\u662f\u7ea7\u8054\u5206\u7c7b\u5668\u53bb\u8bc6\u522b\u56fe\u50cf\u4e2d\u7684\u4eba\u8138\u7279\u5f81\u3002\u8bc6\u522b\u5230\u4eba\u8138\u7279\u5f81\u540e\uff0c\u8fd8\u4e0d\u80fd\u786e\u5b9a\u662f\u5426\u662f\u771f\u6b63\u7684\u4eba\u8138\uff0c\u56e0\u6b64\u9009\u53d6\u4eceRGB\u56fe\u50cf\u4e2d\u83b7\u5f97\u7684\u6f5c\u5728\u771f\u6b63\u4eba\u8138\u533a\u57df\uff0c\u5750\u6807\u6620\u5c04\u5230\u6df1\u5ea6\u56fe\u50cf\u4e2d\uff0c\u5bf9\u6df1\u5ea6\u56fe\u50cf\u4e2d\u5bf9\u5e94\u7684ROI\u533a\u57df\u8ba1\u7b97\u6807\u51c6\u5dee\uff0c\u8bbe\u7f6e\u9608\u503c\u4fbf\u80fd\u5c06\u4e24\u8005\u533a\u5206\u5f00\u6765\u3002\u56e0\u4e3a\u4eba\u8138\u56fe\u7247\u5728\u6df1\u5ea6\u56fe\u4e2d\u5404\u70b9\u7684\u6df1\u5ea6\u4fe1\u606f\u6ca1\u6709\u53d8\u5316\uff0c\u6807\u51c6\u5dee\u5f88\u5c0f\uff1b\u800c\u771f\u6b63\u7684\u4eba\u8138\u5404\u70b9\u6df1\u5ea6\u4fe1\u606f\u53d8\u5316\u660e\u663e\uff0c\u6807\u51c6\u5dee\u5927\u3002
<\/p>\n
ubuntu\u914d\u7f6eopenCV\u4f9d\u8d56\u9879\u53ef\u4ee5\u6309\u7167\u8fd9\u4e2a\uff1ahttps:\/\/blog.csdn.net\/weixin_44232093\/article\/details\/98937652<\/p>\n
\u9664\u4e86OpenCV\u5e93\uff0c\u6211\u8fd8\u7528\u5230\u4e86numpy\u548copenNI\uff0c\u9700\u8981pip\u5b89\u88c5\uff0c\u5b89\u88c5\u65f6\u6362\u6210\u56fd\u5185\u7684\u6e90\u53ef\u4ee5\u5927\u5927\u52a0\u5feb\u5b89\u88c5\u901f\u5ea6\uff0c\u5728\u7528\u6e05\u534e\u6e90pip\u5b89\u88c5\u7684\u65f6\u5019\uff0c\u6211\u9047\u5230\u56e0\u4e3aubuntu\u7cfb\u7edf\u65f6\u95f4\u6ca1\u8c03\uff0c\u65f6\u95f4\u6709\u504f\u5dee\uff0c\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u7684\u60c5\u51b5\uff0c\u89e3\u51b3\u65b9\u6cd5\u5c31\u662f\u628a\u7cfb\u7edf\u65f6\u95f4\u8c03\u6574\u4e3a\u5317\u4eac\u65f6\u95f4\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u7528\u6e05\u534e\u6e90\u6b63\u5e38\u5b89\u88c5python\u5e93\u4e86\u3002\u8fd8\u6709\u4e00\u4e2a\u8981\u6ce8\u610f\u7684\u5c31\u662fDNS\u8981\u8bbe\u7f6e\u4e00\u4e0b\u3002<\/p>\n
4\u3001\u6700\u540e\uff0c\u6211\u60f3\u7528\u4e00\u4e0b\u677f\u5b50\u4e0a\u7684GPIO\u5f15\u811a<\/p>\n
\u67e5\u9605\u4e86Zora P1\u5f00\u53d1\u677f\u7684\u8bf4\u660e\u6587\u6863\uff0c\u770b\u5230\u662f\u67098\u4e2aGPIO\u5f15\u811a\u7684\uff0c\u4e0e\u6811\u8393\u6d3e\u76f8\u6bd4\u4e0d\u662f\u5f88\u591a\u3002\u6211\u7684\u60f3\u6cd5\u662f\u5b9e\u73b0\u4e00\u4e2a\u57fa\u4e8e\u4eba\u8138\u6df1\u5ea6\u4fe1\u606f\u83b7\u53d6\u7684\u667a\u80fd\u98ce\u6247\uff0c\u6839\u636e\u4e4b\u524d\u83b7\u5f97\u7684\u4eba\u8138\u6df1\u5ea6\u4fe1\u606f\uff0c\u4e0e\u8c03\u8282\u98ce\u6247\u8f6c\u901f\u7684\u6a21\u62df\u91cf\u503c\u5efa\u7acb\u5173\u7cfb\uff0c\u5b9e\u73b0\u4eba\u8138\u9760\u8fd1\u65f6\u98ce\u901f\u5927\uff0c\u8fdc\u79bb\u65f6\u98ce\u901f\u5c0f\u7684\u6548\u679c\u3002
\u4e8e\u662f\uff0c\u6211\u4fbf\u67e5\u9605\u4e86Linux\u901a\u8fc7\u6307\u4ee4\u63a7\u5236GPIO\u7684\u76f8\u5173\u5185\u5bb9\uff0c\u64cd\u4f5c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n
\uff081\uff09\u5b9a\u4e49GPIO\uff1a\/sys\/class\/gpio# echo 1 > export\uff0c\u5b9a\u4e49\u597d\u4e4b\u540e\u5728\/sys\/class\/gpio\u8def\u5f84\u4e0b\u4f1a\u751f\u6210gpio1\u6587\u4ef6\u5939\u3002<\/p>\n
\uff082\uff09\u8bbe\u7f6e\u8f93\u5165\/\u8f93\u51fa\uff1a\/sys\/class\/gpio\/gpio1# echo out > direction<\/p>\n
\uff083\uff09\u8bbe\u7f6e\u8f93\u51fa\u503c\uff1a\/sys\/class\/gpio\/gpio1#<\/p>\n
echo 1 > value<\/p>\n
\u8fd9\u91cc\u4e5f\u9047\u5230\u4e00\u4e2a\u95ee\u9898\uff0c\u6211\u7406\u6240\u5f53\u7136\u7684\u8ba4\u4e3a8\u4e2agpio\u53e3\u5bf9\u5e94\u7684\u7f16\u53f7\u4fbf\u662f1~8\uff0c\u5176\u5b9e\u4e0d\u7136\uff0c\u8fd9\u5c31\u5bfc\u81f4\u6211\u5b9a\u4e49GPIO\u662f\u5931\u8d25\u7684\u3002\u4e8b\u5b9e\u4e0a\uff0cZora P1\u7684GPIO\u7f16\u53f7\u5e94\u8be5\u662f\u5728410-495\u548c496-511\u8fd9\u4e24\u4e2a\u8303\u56f4\u5185\uff0c\u4f46\u5177\u4f53\u7684\u5404\u4e2a\u5f15\u811a\u8f6f\u786c\u4ef6\u6620\u5c04\u5173\u7cfb\u8bf4\u660e\u6587\u6863\u6ca1\u6709\u63d0\u4f9b\uff0c\u5e0c\u671b\u540e\u9762\u80fd\u53d1\u5e03\u51fa\u6765\u3002
\u9644python\u4ee3\u7801\uff1a<\/p>\n
from<\/span> openni import<\/span> openni2 \n\timport<\/span> numpy as<\/span> np \n\timport<\/span> cv2 \n\ndef<\/span> mousecallback<\/span>(<\/span>event,<\/span>x,<\/span>y,<\/span>flags,<\/span>param)<\/span>:<\/span> \n\t if<\/span> event==<\/span>cv2.<\/span>EVENT_LBUTTONDBLCLK:<\/span> \n\t print<\/span>(<\/span>y,<\/span> x,<\/span> dpt[<\/span>y,<\/span>x]<\/span>)<\/span> \n\t \nif<\/span> __name__ ==<\/span> \"__main__\"<\/span>:<\/span> \n\n openni2.<\/span>initialize(<\/span>)<\/span> \n\n dev =<\/span> openni2.<\/span>Device.<\/span>open_any(<\/span>)<\/span> \nprint<\/span>(<\/span>dev.<\/span>get_device_info(<\/span>)<\/span>)<\/span> \n\n depth_stream =<\/span> \tdev.<\/span>create_depth_stream(<\/span>)<\/span> \n depth_stream.<\/span>start(<\/span>)<\/span> \n\n cap =<\/span> cv2.<\/span>VideoCapture(<\/span>0<\/span>)<\/span> \ncv2.<\/span>namedWindow(<\/span>'depth'<\/span>)<\/span> \n cv2.<\/span>setMouseCallback(<\/span>'depth'<\/span>,<\/span>mousecallback)<\/span> \n face_detector =<\/span> \tcv2.<\/span>CascadeClassifier(<\/span>\"\/home\/orbbec\/haarcascade_frontalface_default.xml\"<\/span>)<\/span> \n\t while<\/span> True<\/span>:<\/span> \n\n frame =<\/span> depth_stream.<\/span>read_frame(<\/span>)<\/span> \n\t dframe_data =<\/span> \tnp.<\/span>array(<\/span>frame.<\/span>get_buffer_as_triplet(<\/span>)<\/span>)<\/span>.<\/span>reshape(<\/span>[<\/span>480<\/span>,<\/span> 640<\/span>,<\/span> 2<\/span>]<\/span>)<\/span> \n\t dpt1 =<\/span> np.<\/span>asarray(<\/span>dframe_data[<\/span>:<\/span>,<\/span> :<\/span>,<\/span> 0<\/span>]<\/span>,<\/span> dtype=<\/span>'float32'<\/span>)<\/span> \n\t dpt2 =<\/span> np.<\/span>asarray(<\/span>dframe_data[<\/span>:<\/span>,<\/span> :<\/span>,<\/span> 1<\/span>]<\/span>,<\/span> dtype=<\/span>'float32'<\/span>)<\/span> \n\t \ndpt2 *=<\/span> 255<\/span> \n dpt =<\/span> dpt1 +<\/span> dpt2 \n cv2.<\/span>imshow(<\/span>'depth'<\/span>,<\/span> dpt)<\/span> \n\t \n #print(dpt.shape) <\/span>\n\t ret,<\/span>frame =<\/span> cap.<\/span>read(<\/span>)<\/span> \n\t img=<\/span>cv2.<\/span>cvtColor(<\/span>frame,<\/span>cv2.<\/span>COLOR_BGR2GRAY)<\/span> \n\tface_rects=<\/span>face_detector.<\/span>detectMultiScale(<\/span>img,<\/span> 1.3<\/span>,<\/span> 5<\/span>)<\/span> \n\t for<\/span>(<\/span>x,<\/span>y,<\/span>w,<\/span>h)<\/span> in<\/span> face_rects:<\/span> \n\t cv2.<\/span>rectangle(<\/span>frame,<\/span>(<\/span>x,<\/span>y)<\/span>,<\/span>(<\/span>x+<\/span>w,<\/span>y+<\/span>h)<\/span>,<\/span>(<\/span>0<\/span>,<\/span>255<\/span>,<\/span>0<\/span>)<\/span>,<\/span>3<\/span>)<\/span> \n\t face_dpt=<\/span>dpt[<\/span>y:<\/span>y+<\/span>h,<\/span>640<\/span>-<\/span>(<\/span>x+<\/span>w)<\/span>:<\/span>640<\/span>-<\/span>x]<\/span> ##the depth image and the frame are horizontal symmetry <\/span>\n\t \n ##calculate the standard deviation <\/span>\n\t (<\/span>mean,<\/span>stddev)<\/span>=<\/span>cv2.<\/span>meanStdDev(<\/span>face_dpt)<\/span> \n\t #print(stddev) <\/span>\n\t \n ##Set threshold to recognize person true or not <\/span>\n\t if<\/span> stddev><\/span>300<\/span>:<\/span> \n\t cv2.<\/span>rectangle(<\/span>frame,<\/span>(<\/span>x,<\/span>y)<\/span>,<\/span>(<\/span>x+<\/span>w,<\/span>y+<\/span>h)<\/span>,<\/span>(<\/span>0<\/span>,<\/span>255<\/span>,<\/span>0<\/span>)<\/span>,<\/span>3<\/span>)<\/span> \n\t cv2.<\/span>putText(<\/span>frame,<\/span>\"Real Person\"<\/span>,<\/span>(<\/span>x,<\/span>y-<\/span>5<\/span>)<\/span>,<\/span>cv2.<\/span>FONT_HERSHEY_SIMPLEX,<\/span>1<\/span>,<\/span>(<\/span>