{"id":10007061,"date":"2023-01-10T12:25:12","date_gmt":"2023-01-10T04:25:12","guid":{"rendered":"https:\/\/ityet.com\/?p=10007061"},"modified":"2023-01-10T12:25:12","modified_gmt":"2023-01-10T04:25:12","slug":"%e8%a7%86%e9%a2%91%e5%ae%9e%e6%97%b6%e8%87%aa%e7%84%b6%e7%be%8e%e9%a2%9c%ef%bc%8c-%e6%97%a0%e6%83%a7%e7%b4%a0%e9%a2%9c%e4%b8%8a%e9%95%9c","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10007061","title":{"rendered":"\u89c6\u9891\u5b9e\u65f6\u81ea\u7136\u7f8e\u989c\uff0c \u65e0\u60e7\u7d20\u989c\u4e0a\u955c"},"content":{"rendered":"<p>\u534e\u4e3a<a href=\"https:\/\/link.segmentfault.com\/?enc=yFsfuKPIeVk9qIJsup7FcQ%3D%3D.oL7c6jRzcIkCXFpGwq46WLRaHHnADuF7WPCDeTETvMFqXa%2FDofpH0Hnd%2BrGxNkfZ%2FJFDoS%2BMAq1Bv082p44TfxRz6kqE9XMjY%2Fv%2FbZnb8Ks%3D\" rel=\"nofollow\">HMS Core \u89c6\u9891\u7f16\u8f91\u670d\u52a1<\/a>\u4f9d\u6258\u81ea\u8eabAI\u6280\u672f\u7684\u6838\u5fc3\u4f18\u52bf\uff0c\u5728\u6700\u65b0\u7248\u672cHMS Core 6.8.0\u4e2d\u4e0a\u7ebf\u4e86\u5168\u65b0\u7684\u89c6\u9891\u7f8e\u989c\u529f\u80fd\uff0c\u80fd\u5bf9\u6307\u5b9a\u56fe\u7247\u6216\u89c6\u9891\u4e2d\u7684\u4eba\u8138\u5b9e\u73b0\u78e8\u76ae\u3001\u7f8e\u767d\u3001\u5927\u773c\u3001\u7626\u8138\u7684\u7f8e\u989c\u6548\u679c\uff0c\u9002\u7528\u4e8e\u76f4\u64ad\u3001\u76f8\u673a\u3001\u89c6\u9891\u526a\u8f91\u3001\u56fe\u7247\u5904\u7406\u7b49\u573a\u666f\u4e2d\uff0c\u6253\u9020\u72ec\u7279\u81ea\u7136\u7684\u7f8e\u989c\u6548\u679c\u3002<\/p>\n<p>HMS Core\u89c6\u9891\u7f8e\u989c\u529f\u80fd\u5728\u6280\u672f\u4e0a\u4f7f\u7528CPU+NPU+GPU\u5f02\u6784\u5e76\u884c\u6846\u67b6\uff0c\u652f\u6301\u5b9e\u65f6\u7f8e\u989c\u5904\u7406\uff0c\u7b97\u6cd5\u8dd1\u5f97\u66f4\u5feb\u4f46\u7cfb\u7edf\u529f\u8017\u964d\u4f4e\uff0c50fps+\u7aef\u5230\u7aef\u9ad8\u6548\u5904\u7406\uff0c\u80fd\u572810ms\u5185\u5b8c\u6210\u89c6\u9891\u4e2d\u6700\u591a2\u4e2a\u4eba\u8138\uff08\u9762\u79ef\u5360\u6bd4\u8f83\u5927\u76842\u4e2a\u4eba\uff09\u7684\u5904\u7406\uff08\u6570\u636e\u6e90\u4e8e\u534e\u4e3a\u5185\u90e8\u6d4b\u8bd5\uff09\u3002\u4f7f\u7528855\u70b9\u7a20\u5bc6\u4e94\u5b98\u5b9a\u4f4d\uff0c\u7cbe\u51c6\u8bc6\u522b\u4eba\u8138\uff0c\u907f\u514d\u4eba\u8138\u79fb\u52a8\u8fc7\u5feb\u6216\u89d2\u5ea6\u8fc7\u5927\u65f6\uff0c\u7f8e\u989c\u6548\u679c\u53d8\u5f62\u3002\u9488\u5bf9\u7f8e\u989c\u6548\u679c\uff0c\u91c7\u7528\u9762\u90e8\u7cbe\u7ec6\u5206\u533a\uff0c\u7ed3\u5408\u4e2d\u6027\u7070\u81ea\u7136\u78e8\u76ae\uff0c\u66f4\u52a0\u81ea\u7136\u771f\u5b9e\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u4e3a\u6ee1\u8db3\u7528\u6237\u7684\u66f4\u591a\u4e2a\u6027\u5316\u9700\u6c42\uff0c\u534e\u4e3a\u5f00\u653e\u78e8\u76ae\u3001\u7f8e\u767d\u3001\u5927\u773c\u3001\u7626\u8138\u7f8e\u989c\u6548\u679c\u7684\u591a\u7ea7\u8c03\u8282\u529f\u80fd\uff0c\u7528\u6237\u53ef\u6839\u636e\u9700\u6c42\u81ea\u884c\u8c03\u8282\u6548\u679c\uff0c\u52a9\u529b\u5f00\u53d1\u8005\u4ee5\u8f83\u4f4e\u6210\u672c\u5f00\u53d1\u4f18\u79c0\u7684\u89c6\u9891\u7f8e\u989c\u6548\u679c\u3002<\/p>\n<h3>\u7f8e\u989c\u6548\u679c<\/h3>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc5NF0\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u5c31\u4e00\u8d77\u6765\u5b9e\u64cd\u4e00\u4e0b\u5982\u4f55\u63a5\u5165\u534e\u4e3a\u89c6\u9891\u7f16\u8f91\u670d\u52a1\uff0c\u5b9e\u73b0\u89c6\u9891\u7f8e\u989c\u529f\u80fd\u3002<\/p>\n<h3>\u5f00\u53d1\u6b65\u9aa4<\/h3>\n<h4>1.    \u5f00\u53d1\u51c6\u5907<\/h4>\n<p>\u8be6\u7ec6\u51c6\u5907\u6b65\u9aa4\u53ef\u53c2\u8003<a href=\"https:\/\/link.segmentfault.com\/?enc=hRi0HXlK3Zd1j294mlKdNQ%3D%3D.MPdTcBOZBAbqYhbSwOPyG7Sr5V%2FHHdjMnTR39O4iTIcztqxO4QUCRtwoNfMNEFovXmSjQYIimi1pyc2Nr62KU%2FGMlr%2FFrSwtXO4ldWm2FoQHkqboZcB2NSSbsThANTpWLaKDO%2BrCWNFSAUEipW2R8rHv1LXuLuluSUdTOyenC%2BU%3D\" rel=\"nofollow\">\u534e\u4e3a\u5f00\u53d1\u8005\u8054\u76df\u5b98\u7f51<\/a>\u3002<\/p>\n<h4>2.    \u96c6\u6210\u51c6\u5907<\/h4>\n<p>\u8bbe\u7f6e\u5e94\u7528\u7684\u9274\u6743\u4fe1\u606f\u3002\u53ef\u4ee5\u901a\u8fc7api_key\u6216\u8005Access Token\u6765\u8bbe\u7f6e\u5e94\u7528\u9274\u6743\u4fe1\u606f\u3002<\/p>\n<p>\uff08\u63a8\u8350\uff09\u901a\u8fc7<a href=\"https:\/\/link.segmentfault.com\/?enc=GHTEVd1y5KIdiSrwo9uyGQ%3D%3D.BranvEGqpV0x7t2vOZxxfl13FhfSxZ560DT6%2F2eFY2UFfA2VbPEjFJ5vfinyzKeLYummva%2BY1kaiRXmqLP3W%2BGNNrl5dCsGZVjGowvhDeO2GEqr700ZM2LiwwVtEgqeN92mhOBCgOWkeb4FkuC6bheTqn03qPv8gvFodXwX5JQJXevMH3%2B1bRsfZkN0cfWlUJiF7MYHlZzOrzcttPpCvvg%3D%3D\" rel=\"nofollow\">setAccessToken<\/a>\u65b9\u6cd5\u8bbe\u7f6eAccess Token\uff0c\u5728\u5e94\u7528\u542f\u52a8\u65f6\u521d\u59cb\u5316\u8bbe\u7f6e\u4e00\u6b21\u5373\u53ef\uff0c\u65e0\u9700\u591a\u6b21\u8bbe\u7f6e\u3002<\/p>\n<pre><code>HVEAIApplication.getInstance().setAccessToken(&quot;your access token&quot;);<\/code><\/pre>\n<p>\u83b7\u53d6Access Token\u53ef\u53c2\u89c1<a href=\"https:\/\/link.segmentfault.com\/?enc=IMdjuFzUkatY6puYD%2BpHTA%3D%3D.p0mMvLkazOlZWwcYCg6g6fqhf9L9SCI60FAva0Q5CWPKkPf5zW4Cfsg6l%2FaoWrncOGy4rATUTKYB%2FkIMAtTi%2FQy0lkSPASINiXg0sU9hgU3z%2FiD87qg9nOoycD53fe9xJyb9Edm6xK7AGl%2FEUzbtB3L3PRfZv%2BuLfZHUVLtg4%2BY%3D\" rel=\"nofollow\">\u57fa\u4e8eOAuth 2.0\u5f00\u653e\u9274\u6743<\/a>\u5ba2\u6237\u7aef\u6a21\u5f0f\u3002<\/p>\n<p>\u901a\u8fc7<a href=\"https:\/\/link.segmentfault.com\/?enc=JwlaH%2B7iEyuwps15MXdtoQ%3D%3D.0vczrgcv8uoaSEJGonEBe8wbXZu2BKdJbPnOOMEIcWB%2FprzOv%2F04zXhg3UV6v3wlNBXx5qiSo9%2FcrT%2BFIqnOMalp%2B4qnF94VDj3%2F%2FvPBXZMJn2K6f8jjSlCS4GaqCHy8NmTptlU%2BRPcoONGG46nFxOk%2FQ89CGmmD9mL%2BhFK1kxeMffP61wdX8KXgyA%2BsWJgKdi%2BkcR4Rho6fYtcbWn4xHw%3D%3D\" rel=\"nofollow\">setApiKey<\/a>\u65b9\u6cd5\u8bbe\u7f6eapi_key\uff0c\u5728\u5e94\u7528\u542f\u52a8\u65f6\u521d\u59cb\u5316\u8bbe\u7f6e\u4e00\u6b21\u5373\u53ef\uff0c\u65e0\u9700\u591a\u6b21\u8bbe\u7f6e\u3002<\/p>\n<pre><code>HVEAIApplication.getInstance().setApiKey(&quot;your ApiKey&quot;);<\/code><\/pre>\n<p>\u5f53\u60a8\u5728AppGallery Connect\u4e0a\u6ce8\u518c\u60a8\u7684\u5e94\u7528\u65f6\uff0c\u4f1a\u7ed9\u60a8\u7684\u5e94\u7528\u5206\u914dapi_key\uff0c\u53ef\u53c2\u89c1<a href=\"https:\/\/link.segmentfault.com\/?enc=f60p8reOBwdrkpzCE9GRug%3D%3D.wBN680gaJSe6Mm8K2ichcq%2F9o3tYNMJ%2BDU8eSJCaMsADClmc%2BCNfrzLkca1UWw%2Fds58BjoOLq4toaHHTbZCDr%2F%2Fx3B1du4udcAMy%2B7sjSCXHTgul6p5sXJyV5g9jrcoCbIWNpXLu3en7ux2Xt7nMJKgn85nXUsP024BXrzq8LqozyD5emi91RabJZ3dA%2BbQs\" rel=\"nofollow\">\u6dfb\u52a0\u5f53\u524d\u5e94\u7528\u7684AppGallery Connect\u914d\u7f6e\u6587\u4ef6<\/a>\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u8bf7\u52ff\u5c06api_key\u786c\u7f16\u7801\u5728\u4ee3\u7801\u4e2d\uff0c\u540c\u65f6\u4e0d\u8981\u5c06api_key\u5b58\u50a8\u5728\u5e94\u7528\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u5efa\u8bae\u60a8\u5c06api_key\u5b58\u50a8\u5728\u4e91\u4fa7\uff0c\u8fd0\u884c\u65f6\u83b7\u53d6\u3002<\/p>\n<h4>3.    \u7f8e\u989c\u529f\u80fd\u96c6\u6210<\/h4>\n<pre><code>\/\/ \u521b\u5efa\u7f8e\u989c\u7b97\u6cd5\u7c7b\u5b9e\u4f8b\nHVEAIBeauty hveaiBeauty = new HVEAIBeauty();\n \n\/\/ \u521d\u59cb\u5316\u7f8e\u989cAI\u7b97\u6cd5\u5f15\u64ce\nhveaiBeauty.initEngine(new HVEAIInitialCallback() {\n    @Override\n    public void onProgress(int progress) {\n        \/\/ \u521d\u59cb\u5316\u7f8e\u989cAI\u7b97\u6cd5\u5f15\u64ce\u8fdb\u5ea6\n    }\n    @Override\n    public void onSuccess() {\n        \/\/ \u521d\u59cb\u5316\u7f8e\u989cAI\u7b97\u6cd5\u5f15\u64ce\u6210\u529f\n    }\n    @Override\n    public void onError(int errorCode, String errorMessage) {\n        \/\/ \u521d\u59cb\u5316\u7f8e\u989cAI\u7b97\u6cd5\u5f15\u64ce\u5931\u8d25\n    }\n});\n \n\/\/ \u521d\u59cb\u5316\u7f8e\u989c\u7b97\u6cd5opengl\u8fd0\u884c\u73af\u5883\uff0c\u9700\u5728opengl\u6e32\u67d3\u7ebf\u7a0b\u91cc\u8c03\u7528\nhveaiBeauty.prepare();\n \n\/\/ \u8bbe\u7f6e\u9700\u7f8e\u989c\u5904\u7406\u7684\u7eb9\u7406\u7684\u5bbd\u9ad8\uff08textureWidth\uff1a\u7eb9\u7406\u7684\u5bbd\uff1btextureHeight\uff1a\u7eb9\u7406\u7684\u9ad8\uff09\uff0c\u521d\u59cb\u5316\u6216\u7eb9\u7406\u6709\u53d8\u5316\u540e\u8c03\u7528\uff0c\u9700\u5728opengl\u6e32\u67d3\u7ebf\u7a0b\u91cc\u8c03\u7528\n\/\/ resize\u53c2\u6570\u4e3a\u9700\u8981\u5904\u7406\u7684\u7eb9\u7406\u5bbd\u9ad8\uff0c\u53d6\u503c\u9700\u8981\u5927\u4e8e0\nhveaiBeauty.resize(textureWidth, textureHeight);\n \n\/\/ \u7f8e\u989c\u53c2\u6570\u914d\u7f6e\uff0c\u78e8\u76ae\uff0c\u7f8e\u767d\uff0c\u7626\u8138\uff0c\u5927\u773c\uff0c\u4eae\u773c\uff0c \u7f8e\u989c\u7a0b\u5ea6\u8303\u56f4\uff1a[0, 1]\nHVEAIBeautyOptions options = new HVEAIBeautyOptions.Builder().setBigEye(1)\n    .setBlurDegree(1)\n    .setBrightEye(1)\n    .setThinFace(1)\n    .setWhiteDegree(1)\n    .build();\n \n\/\/ \u66f4\u65b0\u7f8e\u989c\u53c2\u6570\uff0c\u521d\u59cb\u5316\u6216\u6709\u4fee\u6539\u540e\u66f4\u65b0\nhveaiBeauty.updateOptions(options);\n \n\/\/ \u8fdb\u884c\u7f8e\u989c\u5904\u7406\uff0c\u5728opengl\u6e32\u67d3\u7ebf\u7a0b\u91cc\u6bcf\u5e27\u8c03\u7528\uff0c\uff08inputTextureId\uff1a\u8f93\u5165\u7684\u7eb9\u7406ID\uff1boutputTextureId\uff1a\u8f93\u51fa\u7684\u7eb9\u7406ID\uff09\n\/\/ \u8bf7\u786e\u4fdd\u8f93\u5165\u6b63\u5411\u671d\u4e0a\u7684\u4eba\u8138\u7684\u7eb9\u7406\u3002\nint outputTextureId = hveaiBeauty.process(inputTextureId);\n \n\/\/ \u91ca\u653e\u7f8e\u989cAI\u7b97\u6cd5\u5f15\u64ce\nhveaiBeauty.releaseEngine();<\/code><\/pre>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=4Dyc18zPvDHz65g5nOKu3w%3D%3D.c%2FZjfEbcyLHdwY3nQS9VCbi855L9ckxw8AzyAiuCqOeG8OIsyx3949VaBtQgDqxNT6fVfySN6qhBbSWuGvxQQQF2UPrvNo9SBeweLyk1MLw%3D\" rel=\"nofollow\">HMS Core\u89c6\u9891\u7f16\u8f91\u670d\u52a1<\/a>\u9664\u4e86\u652f\u6301\u89c6\u9891\u7f8e\u989c\uff0c\u8fd8\u63d0\u4f9b\u57fa\u7840\u89c6\u9891\u7f16\u8f91\u3001\u4e13\u5c5e\u6ee4\u955c\u3001\u4e00\u952e\u67d3\u53d1\u3001\u4eba\u7269\u8ffd\u8e2a\u3001AI\u7740\u8272\u3001\u52a8\u6001\u7167\u7247\u3001\u7cbe\u5f69\u7247\u6bb5\u3001\u4e00\u952e\u52a8\u6548\u3001\u4eba\u8138\u906e\u6321\u3001\u4e00\u952e\u5fae\u7b11\u3001\u76ee\u6807\u5206\u5272\u7b49\u89c6\u9891\u521b\u4f5c\u80fd\u529b\uff0c\u5f00\u53d1\u8005\u53ef\u4f9d\u636e\u5e94\u7528\u573a\u666f\uff0c\u5728App\u4e2d\u8f7b\u677e\u5b8c\u6210\u89c6\u9891\u529f\u80fd\u7684\u96c6\u6210\u3002<\/p>\n<p><strong>\u4e86\u89e3\u66f4\u591a\u8be6\u60c5&gt;&gt;<\/strong><\/p>\n<p>\u8bbf\u95ee<a href=\"https:\/\/link.segmentfault.com\/?enc=rus9q8R7YUZZ99gsDyzNHA%3D%3D.ASlUKmHliiQonIGuUpxtJCLY24oqWR6wU4ED4EEeGHWf5oAr2yvpTArsV%2F8qcJDauVNITpSmltm0sRMJuF3yYw%3D%3D\" rel=\"nofollow\">\u534e\u4e3a\u5f00\u53d1\u8005\u8054\u76df\u5b98\u7f51<\/a>  <br \/>\u83b7\u53d6<a href=\"https:\/\/link.segmentfault.com\/?enc=JeSlz5pHuVGl5XXlcwvW4w%3D%3D.cqryN1jRNYuVJX9lDVjtGq58BQex5HeEiMBwRL8N8%2FTJGivxByb2ubbwtDBPdLTi8ya3oZppMz3Ii1aXHEYAF2Ca6%2F9yrpB9wlq%2Bg4OCNUI%3D\" rel=\"nofollow\">\u5f00\u53d1\u6307\u5bfc\u6587\u6863<\/a>  <br \/>\u534e\u4e3a\u79fb\u52a8\u670d\u52a1\u5f00\u6e90\u4ed3\u5e93\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=zcgkAcBwboJBPdBnvbAsQw%3D%3D.e3X3ArdXJm8JR9LSPIeXnFRa4F4ZsmtccU%2BEQ9zi24M%3D\" rel=\"nofollow\">GitHub<\/a>\u3001<a href=\"https:\/\/link.segmentfault.com\/?enc=p2tGXzw%2FOvkZFb80bpXY%2Bg%3D%3D.ZjsCZOsHfEgOF%2BhRB1cP54pI6v0mAcWrQE%2BfjZJisuc%3D\" rel=\"nofollow\">Gitee<\/a><\/p>\n<p><strong>\u5173\u6ce8\u6211\u4eec\uff0c\u7b2c\u4e00\u65f6\u95f4\u4e86\u89e3 HMS Core \u6700\u65b0\u6280\u672f\u8d44\u8baf~<\/strong><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043289259\">https:\/\/segmentfault.com\/a\/1190000043289259<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u534e\u4e3aHMS Core \u89c6\u9891\u7f16\u8f91\u670d\u52a1\u4f9d\u6258\u81ea\u8eabAI\u6280\u672f\u7684\u6838\u5fc3\u4f18\u52bf\uff0c\u5728\u6700\u65b0\u7248\u672cHMS Core 6.8.0\u4e2d\u4e0a\u7ebf\u4e86\u5168 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10007061","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10007061"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007061\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10007061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10007061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10007061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}