{"id":423,"date":"2010-05-23T22:04:10","date_gmt":"2010-05-23T13:04:10","guid":{"rendered":"http:\/\/nyatla.jp\/nyartoolkit\/wp\/?p=423"},"modified":"2011-12-30T21:26:18","modified_gmt":"2011-12-30T12:26:18","slug":"nywin32capture1-0-0%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9","status":"publish","type":"post","link":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/?p=423","title":{"rendered":"NyWin32Capture\/1.0.0\u30ea\u30ea\u30fc\u30b9"},"content":{"rendered":"<p>Windows\u5411\u3051\u306e\u30ad\u30e3\u30d7\u30c1\u30e3\u30e9\u30a4\u30d6\u30e9\u30eaNyWin32Capture\/1.0.0\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/?page_id=361\">http:\/\/nyatla.jp\/nyartoolkit\/wp\/?page_id=361<\/a><\/p>\n<p>\u3053\u306e\u624b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u4ed6\u306b\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u5999\u306b\u8907\u96d1\u3060\u3063\u305f\u308a\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u96e3\u3057\u304b\u3063\u305f\u308a\u3001\u4f55\u304b\u306e\u304a\u307e\u3051\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u306e\u3092\u30b3\u30f3\u30bb\u30d7\u30c8\u306b\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u7279\u5fb4\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>C++\u30a4\u30f3\u30bf\u30d5\u30a7\u30a4\u30b9\u3002<\/li>\n<li>\u4f7f\u3044\u65b9\u304c\u7c21\u5358<\/li>\n<li>\u540c\u671f\/\u975e\u540c\u671f\u30ad\u30e3\u30d7\u30c1\u30e3\u4e21\u65b9OK<\/li>\n<li>Windows PSDK 7.1\u5bfe\u5fdc\u3000\u2190new<\/li>\n<\/ul>\n<h2>\n\u540c\u68b1\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p style=\"padding-left: 30px;\">\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\uff12\u3064\u5165\u3063\u3066\u3044\u307e\u3059\u3002GUI\u5236\u5fa1\u306bMFC\u3092\u4f7f\u3063\u305f\u306e\u3067\u3001\u3061\u3087\u3063\u3068\u3084\u3084\u3053\u3057\u3044\u3002<\/p>\n<ul style=\"padding-left: 30px;\">\n<li>NyWin32CaptureTest &#8211; \uff11\u500b\u306e\u30ab\u30e1\u30e9\u304b\u3089\u753b\u50cf\u3092\u53d6\u5f97\u3057\u3066\u3001\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u306b\u3057\u3066\u30a6\u30a4\u30f3\u30c9\u30a6\u306b\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3002<\/li>\n<li>NyWin32CaptureTest &#8211; \u8907\u6570\u306e\u30ab\u30e1\u30e9\u304b\u3089\u753b\u50cf\u3092\u53d6\u5f97\u3057\u3066\u3001\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u306b\u3057\u3066\u30a6\u30a4\u30f3\u30c9\u30a6\u306b\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3002\uff08\u4f55\u53f0\u3067\u3082\u63a5\u7d9a\u3067\u304d\u308b\u306f\u305a\u3060\u3051\u3069\u3001\uff12\u53f0\u307e\u3067\u3057\u304b\u30c6\u30b9\u30c8\u3057\u3066\u306a\u3044\u3002\uff09<\/li>\n<\/ul>\n<p style=\"padding-left: 30px;\">\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p>\u540c\u68b1\u30b5\u30f3\u30d7\u30eb\u306fMFC\u306e\u8fba\u308a\u304c\u3084\u3084\u3053\u3057\u3044\u306e\u3067\u3001\u7d14\u7c8b\u306b\u30ad\u30e3\u30d7\u30c1\u30e3\u3059\u308b\u3060\u3051\u306e\u30b3\u30fc\u30c9\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>\n\u540c\u671f\u53d6\u5f97(\u4efb\u610f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u753b\u50cf\u3092\u53d6\u5f97\u3059\u308b)<\/h3>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;NyWin32Capture.h&quot;\r\n\r\nusing namespace NyWin32Capture;\r\nvoid main(void)\r\n{\r\n    CoInitialize(NULL);\r\n    {\r\n        CaptureDeviceList cap_list;\r\n\r\n        \/\/\u30ad\u30e3\u30d7\u30c1\u30e3\u30c7\u30d0\u30a4\u30b9\u306e\u30ea\u30b9\u30c8\u304b\u30890\u756a\u76ee\u306e\u30ab\u30e1\u30e9\u3092\u5f97\u308b\u3002\r\n        int nod=cap_list.getNumberOfDevice();\r\n        if(nod&lt;1){\r\n            throw std::exception(\r\n                &quot;This computer has not Capture device.&quot;);\r\n        }\r\n\r\n        \/\/0\u756a\u76ee\u306e\u30ab\u30e1\u30e9\u3092\u3042\u3051\u308b\u3002\r\n        CaptureDevice* d=cap_list.getDevice(0);\r\n        d-&gt;openDevice();\r\n        \r\n        \/\/\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30c8\u63a5\u7d9a\u3092\u4f7f\u3063\u3066\u30ad\u30e3\u30d7\u30c1\u30e3\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8a2d\u5b9a\r\n        \/\/ QVGA\u306e24BIT RGB\r\n        if(!d-&gt;setVideoFormat(320,240,MEDIASUBTYPE_RGB24,30.0)){\r\n            throw std::exception(\r\n                &quot;This computer dose not support the format.&quot;);\r\n        }\r\n        unsigned char buf&#x5B;320*240*3];\r\n\r\n        d-&gt;startCapture();\r\n\r\n        \/\/\u540c\u671f\u30ad\u30e3\u30d7\u30c1\u30e3\u306f\u30c7\u30d0\u30a4\u30b9\u306e\u6e96\u5099\u304c\u3067\u304d\u308b\u307e\u3067\u5931\u6557\u3059\u308b\u3002\r\n        while(!d-&gt;captureImage(buf)){\r\n            Sleep(100);\r\n        }\r\n        \/\/buf\u306b\u30ad\u30e3\u30d7\u30c1\u30e3\u30a4\u30e1\u30fc\u30b8\u304c\u53d6\u308c\u308b\u3002\r\n        d-&gt;captureImage(buf);\r\n\r\n        \/\/\u30ad\u30e3\u30d7\u30c1\u30e3\u505c\u6b62\r\n        d-&gt;stopCapture();\r\n\r\n        \/\/\u30c7\u30d0\u30a4\u30b9\u30af\u30ed\u30fc\u30ba\r\n        d-&gt;closeDevice();\r\n    }\r\n    CoUninitialize();\r\n\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u975e\u540c\u671f\u53d6\u5f97(\u30ab\u30e1\u30e9\u304b\u3089\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3067\u30ad\u30e3\u30d7\u30c1\u30e3\u3059\u308b\uff09<\/h3>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;NyWin32Capture.h&quot;\r\n#include &quot;conio.h&quot;\r\n\r\n\r\nusing namespace NyWin32Capture;\r\n\r\nvoid MyOnCaptureImage(\r\n    const CaptureDevice* i_sender,BYTE *pBuffer, long BufferLen)\r\n{\r\n    printf(&quot;OnCaptureImage! Image\\n&quot;);\r\n}\r\n\r\nvoid main(void)\r\n{\r\n    CoInitialize(NULL);\r\n    {\r\n        CaptureDeviceList cap_list;\r\n\r\n        \/\/\u30ad\u30e3\u30d7\u30c1\u30e3\u30c7\u30d0\u30a4\u30b9\u306e\u30ea\u30b9\u30c8\u304b\u30890\u756a\u76ee\u306e\u30ab\u30e1\u30e9\u3092\u5f97\u308b\u3002\r\n        int nod=cap_list.getNumberOfDevice();\r\n        if(nod&lt;1){\r\n            throw std::exception(\r\n                &quot;This computer has not Capture device.&quot;);\r\n        }\r\n\r\n        \/\/0\u756a\u76ee\u306e\u30ab\u30e1\u30e9\u3092\u3042\u3051\u308b\u3002\r\n        CaptureDevice* d=cap_list.getDevice(0);\r\n        d-&gt;openDevice();\r\n        \r\n        \/\/\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30c8\u63a5\u7d9a\u3092\u4f7f\u3063\u3066\u30ad\u30e3\u30d7\u30c1\u30e3\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8a2d\u5b9a\r\n        \/\/ QVGA\u306e24BIT RGB\r\n        if(!d-&gt;setVideoFormat(320,240,MEDIASUBTYPE_RGB24,30.0)){\r\n            throw std::exception(\r\n                &quot;This computer dose not support the format.&quot;);\r\n        }\r\n\r\n        \/\/\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f7f\u3063\u305f\u30ad\u30e3\u30d7\u30c1\u30e3\u3092\u958b\u59cb\r\n        d-&gt;startCaptureCallback(MyOnCaptureImage);\r\n\r\n        \/\/\u4f55\u304b\u62bc\u3059\u307e\u3067\u5f85\u3064\r\n        getch();\r\n\r\n        \/\/\u30ad\u30e3\u30d7\u30c1\u30e3\u505c\u6b62\r\n        d-&gt;stopCapture();\r\n\r\n        \/\/\u30c7\u30d0\u30a4\u30b9\u30af\u30ed\u30fc\u30ba\r\n        d-&gt;closeDevice();\r\n    }\r\n    CoUninitialize();\r\n}\r\n<\/pre>\n<p>\uff12\u3064\u306e\u9055\u3044\u306f\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u306e\u958b\u59cb\u306b\u4f7f\u3046API\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>NyARToolkitCPP\u306b\u3082\u3001\u30ec\u30f3\u30c0\u30e9\u90e8\u5206\u306e\u30b3\u30fc\u30c9\u304c\u66f8\u304d\u3042\u304c\u308a\u6b21\u7b2c\u3001\u30d0\u30f3\u30c9\u30eb\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows\u5411\u3051\u306e\u30ad\u30e3\u30d7\u30c1\u30e3\u30e9\u30a4\u30d6\u30e9\u30eaNyWin32Capture\/1.0.0\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3059\u3002 http:\/\/nyatla.jp\/nyartoolkit\/wp\/?page_id=361 \u3053\u306e\u624b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u4ed6\u306b\u3082\u3042\u308a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,14],"tags":[],"_links":{"self":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/423"}],"collection":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=423"}],"version-history":[{"count":2,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":425,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/423\/revisions\/425"}],"wp:attachment":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}