{"id":1827,"date":"2015-03-03T23:30:18","date_gmt":"2015-03-03T14:30:18","guid":{"rendered":"http:\/\/mattyan.net\/blog\/?p=1827"},"modified":"2015-03-03T23:30:18","modified_gmt":"2015-03-03T14:30:18","slug":"raspberry-pi%e3%81%abweb%e3%82%ab%e3%83%a1%e3%83%a9%e3%82%92%e3%81%a4%e3%81%aa%e3%81%92%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=1827","title":{"rendered":"Raspberry PI\u306bWeb\u30ab\u30e1\u30e9\u3092\u3064\u306a\u3052\u3066\u307f\u305f"},"content":{"rendered":"<p>RasberryPI\u306bWeb\u30ab\u30e1\u30e9\u3092\u3064\u306a\u3052\u3066\u307f\u305f\u3002<br \/>\n<!--more--><br \/>\nWeb\u30ab\u30e1\u30e9\u306fELECOM\u306e<a href=\"http:\/\/www2.elecom.co.jp\/multimedia\/pc-camera\/ucam-c0220fb\/\">UCAM-C0220FB<\/a>\u3092\u8cb7\u3063\u3066\u304d\u305f\u3002<br \/>\nRaspberryPI\u306eUSB\u30dd\u30fc\u30c8\u306b\u3064\u306a\u3052\u3066[bash]lsusb[\/bash]\u3067\u63a5\u7d9a\u3092\u78ba\u8a8d\u3002<br \/>\n[bash]<br \/>\nsudo apt-get update<br \/>\nsudo apt-get install libopencv-dev<br \/>\n[\/bash]<br \/>\n\u3067OpenCV\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u7528\u610f\u3002<br \/>\n[c]<br \/>\n#include &lt;stdio.h&gt;<br \/>\n#include &lt;cv.h&gt;<br \/>\n#include &lt;highgui.h&gt;<br \/>\n#include &lt;stdio.h&gt;<br \/>\nint main(){<br \/>\n\tCvCapture *camera = NULL;<br \/>\n\tIplImage *image;<br \/>\n\t\/\/setup<br \/>\n\tcamera = cvCreateCameraCapture(0);<br \/>\n\tif(camera == NULL){<br \/>\n\t\tprintf(&quot;camera not found!\\n&quot;);<br \/>\n\t\treturn 1;<br \/>\n\t}<br \/>\n\tcvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_WIDTH, 1024);<br \/>\n\tcvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_HEIGHT, 768);<br \/>\n\t\/\/capture<br \/>\n\timage = cvQueryFrame(camera);<br \/>\n\tcvSaveImage(&quot;capture.jpg&quot;, image,NULL);<br \/>\n\t\/\/release<br \/>\n\tcvReleaseCapture(&amp;camera);<br \/>\n\treturn 0;<br \/>\n}<br \/>\n[\/c]<br \/>\n\u3067Makefile<\/p>\n<pre>\nCC=gcc\nCFLAGS=-I\/usr\/include\/opencv\nLDFLAGS=\nLIBS=`pkg-config --libs opencv` -lm\nOBJS=test.o\nall: capture\ncapture: $(OBJS)\n\t$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@\n.c.o:\n\t$(CC) $(CFLAGS) $< -c -o $@\n<\/pre>\n<p>\u3092\u66f8\u3044\u3066<br \/>\n[bash]<br \/>\nmake<br \/>\n.\/capture<br \/>\n[\/bash]<br \/>\n\u3067\u30d3\u30eb\u30c9&\u5b9f\u884c\u3002<br \/>\nVIDIOC_QUERYMENU: Invalid argument<br \/>\n\u3068\u51fa\u3066\u304d\u305f\u3051\u3069<br \/>\n<img decoding=\"async\" src=\"http:\/\/mattyan.net\/blog\/wp-content\/uploads\/2015\/03\/capture.jpg\" style=\"width: 100%;\"><br \/>\n\u7121\u4e8b\u306b\u30ad\u30e3\u30d7\u30c1\u30e3\u3067\u304d\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RasberryPI\u306bWeb\u30ab\u30e1\u30e9\u3092\u3064\u306a\u3052\u3066\u307f\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-1827","post","type-post","status-publish","format-standard","hentry","category-3","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1827"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1827\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}