ã¯ããã«
ã第3åç®ã®æ¬ç¨¿ã¯ããdocomo Developer supportãã§å ¬éäºå®ã¨ãªã£ã¦ãããPUX社ã®æè¡ãç¨ããé¡ã»ãªãã¸ã§ã¯ãèªèAPIã使ã£ã¦ãé¡ãã¢ã¶ã¤ã¯ã«ãªã£ã¦åãã¢ã¶ã¤ã¯ã«ã¡ã©ã¢ããªãä½ã£ã¦ã¿ã¾ãããdocomo Developer supportãã§ã¯ããã®APIã®ããã«ãNTTãã³ã¢ä»¥å¤ãéçºããAPIãå ¬éããã¦ãããä»å¾ããã¾ãã¾ãªAPIãå¢ããäºå®ã«ãªã£ã¦ãã¾ãï¼æ¬ç¨¿ã¯ã2015å¹´1æ29æ¥æç¹ã®ææ°æ å ±ã«åºã¥ãã¦ããã¾ãï¼ã
対象èªè
ãJavaã¨Eclipseãç¨ããAndroidã¢ããªã®éçºã§ãåºæ¬çãªç¥èãããæ¹ã対象ã¨ãã¾ãã
é¡ã»ãªãã¸ã§ã¯ãèªèAPI
ãé¡ã»ãªãã¸ã§ã¯ãèªèã¨ã¯ãåçãåç»ãªã©ã®ç»åãããç¹å®ã®äººç©ããã®ï¼ãªãã¸ã§ã¯ãï¼ãèªèããæè¡ã§ããæåã«ãã©ã®ãããªæ©è½ãããããç´¹ä»ãã¦ããã¾ãã
æä¾ãããAPIã®æ¦è¦
ãæä¾ãããAPIã¯ã次ã®4ã¤ã§ãã
ï¼1ï¼é¡æ¤åº
ãåçãªã©ã®ç»åããã人éã®é¡ãè¦ã¤ãããã¨ãã§ãã¾ããä¸åº¦ã®ã¢ã¯ã»ã¹ã§ãæ大20人ã¾ã§ã®é¡ãèªèãããã¨ãã§ãã¾ããã¾ããé¡ã®æ å ±ã¨ãã¦ãç®ãé¼»ãªã©ã®ãã¼ãã®ä½ç½®ãæ§å¥ãå¹´é½¢ã¾ã§ãå¤å®ã§ãã¾ãã
ï¼2ï¼é¡èªè¨¼
ãç»åã®ä¸ãããäºåã«ç»é²ããé¡ç»åã¨ä¼¼ãé¡ãè¦ã¤ãããã¾ããçµæã®æ å ±ã«ã¯ãã©ã®ç¨åº¦ä¼¼ã¦ããããã¨ããã¬ãã«ã®æ°å¤ãå«ã¾ãã¦ãã¾ãã
ï¼3ï¼ãªãã¸ã§ã¯ãèªè
ãä»»æã®ç»åãç»é²ããç»é²ãããã®ãå¥ã®ç»åããæ¢ãåºããã¨ãã§ãã¾ãããã¬ã¦ãããå¾ãã¦ãããã大ããã®éããã®ã§ãèªèå¯è½ã§ãã
ï¼4ï¼ææ¸ãæåèªè
ãç»é¢ä¸ã«ãã³ãªã©ã§æ¸ããæåããç¬èªã®ãã¿ã¼ã³èªèæè¡ã§ãæåã¨ãã¦ç¹å®ã§ãã¾ããç»åãã¼ã¿ã®ãããªäºåã«æ¸ãããæåã®èªèã§ã¯ãªãããªã¢ã«ã¿ã¤ã ã«å ¥åãããçè·¡ã®èªèãå¯è½ã§ãã
ãã©ã¦ã¶ã§APIã試ãã¦ã¿ãã
ããããã®APIã¯ãWeb APIã¨ãã¦æä¾ããã¾ãã®ã§ãã¾ãã¯ãã©ã¦ã¶ã使ã£ã¦ãå ·ä½çã«ã©ã®ãããªæ©è½ãªã®ããè¦ã¦ããã¾ãããã
é¡æ¤åºï¼faceDetectionï¼
ãæ¤åºå ã®ç»åã¯ãã¤ã³ã¿ã¼ãããä¸ã®URLãæå®ããããç»åãã¼ã¿ãã¢ãããã¼ããã¾ããç»åãã¼ã¿ãã¢ãããã¼ãããå ´åã¯ãHTMLãã©ã¼ã ã使ã£ã¦ãã¡ã¤ã«éä¿¡ããããã¾ãã¯ç»åãã¼ã¿ãããã¤ããªã®ã¾ã¾ãBase64æååã«å¤æãã¦ãPOSTã¡ã½ããã§éä¿¡ãã¾ããããã§ã¯ãããªã¼ç´ æã¢ã¤ãã«ã®ç»åï¼ããªã¼ç´ æã¢ã¤ãã«ã®é¡ç»åï¼ã使ã£ã¦æ¤åºãã¦ã¿ã¾ãã
ããã©ã¦ã¶ã§ã以ä¸ã®URLãéãã¦ã¿ã¾ãããããªããAPIKEYã®ãã©ã¡ã¼ã¿ã«ã¯ããdocomo Developer supportãã§åå¾ãããã¼ãè¨å®ãã¦ãã ããã
https://api.apigw.smt.docomo.ne.jp/puxImageRecognition/v1/faceDetection?APIKEY=XXXXX&imageURL=http://takae.sakura.ne.jp/wings/image1.jpg
ãAPIã®ãã¼ã¹ã®URLã¯ãhttps://api.apigw.smt.docomo.ne.jp/puxImageRecognition/v1/ã§ããã®å¾ã«ãæ©è½åï¼ããã§ã¯faceDetectionï¼ãä»å ãã¾ãã
ããã©ã¡ã¼ã¿ã¯ãAPIKEY以å¤ã§ã¯ãé¡ç»åã®URLï¼imageURLï¼ãæå®ããã ãã§èªèå¯è½ã§ããã¬ã¹ãã³ã¹ã¯ãããã©ã«ãã§ã¯XMLæååã§ããããªãã·ã§ã³ã®responseãã©ã¡ã¼ã¿ã«jsonãæå®ããã°ãJSONæååã«ãªãã¾ãã
ãã¬ã¹ãã³ã¹ãã¼ã¿ã¯ãé¡æ¤åºçµææ å ±ï¼faceRecognitionï¼ãã«ã¼ãã¨ãã¦ãé¡æ å ±ï¼detectionFaceInfoï¼ãé¡åº§æ¨ï¼faceCoordinatesï¼ãé¡é¨å座æ¨ï¼facePartsCoordinatesï¼ãåå¤å®çµæï¼ï½Judgeï¼ã§ãã
ãåå¤å®ã¯ãããã©ã«ãã§ãç¬ããå¹´é½¢ãæ§å¥ãé¡ã®åããç¬é¡åº¦ã®çµæãå«ã¾ãã¾ãããªãã·ã§ã³ã§ã¯ãåç©é¡ãã©ãé¡ãå°ãé¡ãªã©ãå¤å®å¯è½ã§ãã
ããã®ã»ãã詳細ã«ã¤ãã¦ã¯ããµã¤ãã®ä»æ§æ¸ãåç §ãã¦ãã ããã
é¡èªè¨¼ï¼faceRecognitionï¼
ãä»åº¦ã¯ãç¹å®ã®é¡ã§èªè¨¼ãã¦ã¿ã¾ããããã¾ããé¡ã®ç»åãç»é²ãã¾ãã
ãé¡ã®ç»é²ã¯ãfaceRecognitionã®å¾ã«ãmodeãã©ã¡ã¼ã¿ã¨ãã¦ãregisterãæå®ãã¾ãã
https://api.apigw.smt.docomo.ne.jp/puxImageRecognition/v1/faceRecognition?APIKEY=XXXXXX&mode=register&imageURL=http://takae.sakura.ne.jp/wings/image1.jpg
ãç»é²ãããã¨ãã¬ã¹ãã³ã¹ã®registrationFaceInfoã¿ã°ã«ãä»ä¸ãããç»åã®IDãæ ¼ç´ããã¾ãã
<registrationFaceInfo> <meta/> <faceId>1</faceId> <imagePath>http://eval.st1.polestars.jp/webapi/public/41016555a056124b20d013758cea2b04/20150109153901834_PC.jpg </imagePath> </registrationFaceInfo>
ãç»é²ã§ãã¾ããã®ã§ãå¥ã®ç»åã§èªè¨¼ãã¦ã¿ã¾ãããã
ãèªè¨¼ã¯ãmodeãã©ã¡ã¼ã¿ã«ãverifyãæå®ãã¾ãã
https://api.apigw.smt.docomo.ne.jp/puxImageRecognition/v1/faceRecognition?APIKEY=XXXXXX&mode=verify&imageURL=http://takae.sakura.ne.jp/wings/image2.jpg
ãèªè¨¼çµæã¯ãverificationFaceInfoã¿ã°ã«æ ¼ç´ããã¾ããèªè¨¼ã«ç¨ããç»åã®IDï¼faceIdï¼ã¨ãã©ã®ãããä¼¼ã¦ãããã®èªèã¹ã³ã¢ï¼scoreã100以ä¸ï¼ã®æ å ±ãå«ã¾ãã¦ãã¾ãã
<verificationFaceInfo> <faceCoordinates> </faceCoordinates> <candidate> <score>91</score> <faceId>1</faceId> <meta/> </candidate> </verificationFaceInfo>
ãªãã¸ã§ã¯ãèªèï¼objectRecognitionï¼
ããªãã¸ã§ã¯ãèªèAPIã¯ãé¡èªè¨¼APIã¨åæ§ã®ä½¿ãæ¹ã§ãããã ããã¬ã¹ãã³ã¹ãã¼ã¿ã«ã¯ãé¡èªè¨¼ã¨ç°ãªããèªèãªãã¸ã§ã¯ãæ å ±ï¼recognitionObjectInfoï¼ã¨ãã¦ããªãã¸ã§ã¯ãã®åº§æ¨ãè§åº¦ãèªèã¹ã³ã¢ãå«ã¾ãã¦ãã¾ãã
ææ¸ãæåèªèï¼rakuhiraï¼
ãææ¸ãæåèªèã§ã¯ãä¸æåã®èªèãå¯è½ã§ããAPIã®å¼ã³åºãã¯ãçè·¡ã®åº§æ¨ãã¼ã¿ãå¿ è¦ã¨ãªãããã¼ã¿éãå¤ããªãã¾ãã®ã§ãPOSTã¡ã½ããã®ã¿ã«å¯¾å¿ãã¦ãã¾ãã
ããã©ã¡ã¼ã¿ã«ã¯ãæåå ¥åã®æ ãµã¤ãºï¼frameSizeWidthãframeSizeHeightï¼ããã®æ å ã®ç跡座æ¨æ å ±ï¼coordinatePointArrayï¼ãªã©ãæå®ãã¾ããèªèå¯è½ãªæåã¯ãæ¼¢åãã«ã¿ã«ããã²ãããªãè¨å·ãã¢ã«ãã¡ãããã«ãªãã¾ãã
ãã¬ã¹ãã³ã¹ãã¼ã¿ã¯ãèªèçµæï¼handwritingRecognitionï¼ã¨ãã¦ãæåã³ã¼ãï¼recognitionResultï¼ã®ãªã¹ããå«ã¾ãã¾ãã
ãä¾ãã°ããé«ãã®æåãèªèãããå ´åã¯ã次ã®ããã«ãé«ãèµã窩ãå¯ãè²¢ãè¿ã¨ããæåã³ã¼ãã®ãªã¹ãã¨ãªãã¾ããã
"frameSizeWidth":256 "frameSizeHeight":256 "coordinatePointArray":{(96,22),(97,22),(98,23),(98,24),(99,24),...}
<handwritingRecognition> <recognitionResultList> <recognitionResult>0x9ad8</recognitionResult> <recognitionResult>0x8435</recognitionResult> <recognitionResult>0x7aa9</recognitionResult> <recognitionResult>0x5bcc</recognitionResult> <recognitionResult>0x8ca2</recognitionResult> <recognitionResult>0x84bf</recognitionResult> </recognitionResultList> </handwritingRecognition>