๋ฌธ์
VideoCapture ํด๋์ค ๋ฌธ์์์ ์ด ์์ ์ฝ๋๋ฅผ ์คํํ๋ฉด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int, char**)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);
if(waitKey(30) >= 0) break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
_ ์ค๋ฅ: _
libv4l2: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl S_FMT
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT
์ง๊ธ๊น์ง ๋ด ๊ฑธ์
๊ฐ๋ฅํ ํด๊ฒฐ์ฑ
USB๋ก ์ฐ๊ฒฐ๋ Logitech qc 3000๊ณผ ๋ด์ฅ ์น์บ ์์ ๋ชจ๋ ์๋ํ์ง ์์ต๋๋ค.
์์คํ
์ฐ๋ถํฌ 16.
์น์บ ์์ ๋น๋์ค ์คํธ๋ฆผ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค. (๋์ค์ ๋ ๋ง์ ์น์บ ์์)
์๋ง๋ ํด๊ฒฐ๋์์ต๋๋ค. ํ๋ก๊ทธ๋จ์ ํ ์ธ์คํด์ค๋ฅผ ์ข
๋ฃํด๋ ์น์บ ์ด ํด์ ๋์ง ์์ ๋ค์ ์คํํ์ฌ ์ถฉ๋์ด ๋ฐ์ํ์ต๋๋ค. ๋ํ ์ด ์์ ์ฝ๋ ํ์ผ๋ก ์ธํด ์ด์ํ ๋์์ด ๋ฐ์ํ์ต๋๋ค.
if(waitKey(30) >= 0) break
;
๊ฑฐ์ ์ฆ์ ๋ฉ์ถ๊ฒ ํ๊ธฐ ์ํด continue
๋ก ๋ณ๊ฒฝํ์ฌ ์ด์ ์คํธ๋ฆผ์ด ๋์ด ์์ต๋๋ค.
์ค์ ๋ก ์ฌ๋ฐ๋ฅธ ์์ต์์ ์ํ ์ฝ๋๋ฅผ ์ํ๋ฉด 2.4 ๋ฌธ์ ๋์ ์ต์ ๋ฌธ์๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ์๋ ค์ฃผ์ ๋งํฌ๊ฐ ์ค์ ๋ก ์๋ํ์ง ์์์ 3.2์์๋ ๋ฌธ์ ๊ฐ ๊ณ์ ๋ฐ์ํ๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
์ฅ์น ๋๋ ๋ฆฌ์์ค ์ฌ์ฉ ์ค
๋ฌธ์ ๋ ์ฌ๊ธฐ ์ด๋๊ฐ์ ์์ต๋๋ค.
์ฌ์ฉ ์ง๋ฌธ์ ์ฌ์ฉ์ OpenCV Q/A ํฌ๋ผ์ผ๋ก ์ด๋ํด์ผ ํฉ๋๋ค. http://answers.opencv.org