반응형



1. WiringPi 다운로드 및 설치


$ git clone git://git.drogon.net/wiringPi

$ cd wiringPi

$ ./build




11번핀에 LED를 연결하고 16번 핀에 버튼을 연결합니다. 




아래처럼 컴파일해서 실행시켜보면

$ gcc main.c -lwiringPi

$ sudo ./a.out

버튼을 누를때 마다 LED가 켜지는 것을 확인 할 수 있습니다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <wiringPi.h>
 
const int ledPin = 17;//pin 11(GPIO 17)
const int butPin = 23;//pin 16(GPIO 23)
 
int main(void)
{
    wiringPiSetupGpio(); 
 
    pinMode(ledPin, OUTPUT);//LED를 위해 출력으로 설정 
    pinMode(butPin, INPUT);//버튼을 위해 입력으로 설정
    pullUpDnControl(butPin, PUD_UP);
 
    while(1)
    {
        
        int ret = digitalRead(butPin);
        if ( ret ) 
        {
            digitalWrite(ledPin, LOW); 
        }
        else 
        {
            digitalWrite(ledPin, HIGH); 
        }
    }
 
    return 0;
}
 
cs



2. pi camera 라이브러리 설치

$ wget https://sourceforge.net/projects/raspicam/files/raspicam-0.1.3.zip

$ unzip raspicam-0.1.3.zip

$ cd raspicam-0.1.3/

$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig



파이 카메라 연결 및 설정은 아래 포스팅을 확인하세요 


[임베디드/Raspberry Pi] - Raspberry Pi 3에서 camera V2 사용 해보기



아래처럼 컴파일 후 실행시켜 보면 버튼을 누를때마다 raspicam_image.ppm라는 파일 이름으로 파이캠으로부터 캡처된 영상이 저장됩니다. 

$ g++  picam.cpp  -I/usr/local/include -lraspicam  -lwiringPi


$ sudo ./a.out


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <ctime>
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <raspicam/raspicam.h>
#include <wiringPi.h>
 
using namespace std;
 
const int ledPin = 17;//pin 11(GPIO 17)
const int butPin = 23;//pin 16(GPIO 23)
 
 
int main ( int argc,char **argv ) 
{
 
    raspicam::RaspiCam Camera;
 
    //Open camera 
    cout<<"Opening Camera..."<<endl;
    if ( !Camera.open()) {
        cerr<<"Error opening camera"<<endl;
        return -1;
    }
 
    //wait a while until camera stabilizes
    cout<<"wait a minutes"<<endl;
    usleep(3000000);
 
 
 
    wiringPiSetupGpio(); 
 
    pinMode(ledPin, OUTPUT);//LED를 위해 출력으로 설정 
    pinMode(butPin, INPUT);//버튼을 위해 입력으로 설정
    pullUpDnControl(butPin, PUD_UP);
 
 
    cout<<"now press button"<<endl;
 
 
    while(1)
    {
        
        int ret = digitalRead(butPin);
        if ( ret ) 
        {
            digitalWrite(ledPin, LOW); 
        }
        else 
        {
            digitalWrite(ledPin, HIGH); 
 
            //capture
            Camera.grab();
 
            //allocate memory
            unsigned char *data=new unsigned char[  Camera.getImageTypeSize ( raspicam::RASPICAM_FORMAT_RGB )];
 
            //extract the image in rgb format
            Camera.retrieve ( data,raspicam::RASPICAM_FORMAT_RGB );//get camera image
 
            //save
            std::ofstream outFile ( "raspicam_image.ppm",std::ios::binary );
 
            outFile<<"P6\n"<<Camera.getWidth() <<" "<<Camera.getHeight() <<" 255\n";
            outFile.write ( ( char* ) data, Camera.getImageTypeSize ( raspicam::RASPICAM_FORMAT_RGB ) );
 
            cout<<"Image saved at raspicam_image.ppm"<<endl;
        
            //free resrources    
 
            delete data;
        }
    }
 
    return 0;
}
 
cs





웹캠으로 촬영된 영상을 보기 위해 패키지를 설치합니다. 

$ sudo apt-get install pqiv


VNC로 라즈베리파이를 연결 혹은 HDMI로 모니터랑 파이가 연결되어 있는 상황에서 실행시키면 촬영된 사진이 보입니다. 

$ pqiv -f raspicam_image.ppm





반응형

포스트 작성시에는 문제 없었지만 이후 문제가 생길 수 있습니다.
댓글로 알려주시면 빠른 시일내에 답변을 드리겠습니다.

여러분의 응원으로 좋은 컨텐츠가 만들어집니다.
지금 본 내용이 도움이 되었다면 유튜브 구독 부탁드립니다. 감사합니다 : )

유튜브 구독하기


제가 쓴 책도 한번 검토해보세요.

  1. 2016.08.14 22:56

    비밀댓글입니다

  2. 무명 2017.12.12 03:07

    게시글로 참 많은 도움이 되고 있습니다. 너무 감사합니다.

    sudo ./a.out으로 실행하면 다음 메세지에서 십분이상 멈추어 있습니다.

    Opening Camera...
    wait a minutes

    모니터를 별도로 HDMI포트로 파이와 연결하였고 파이는 공유기에 랜선으로 물려있으며
    MOBAXTERM으로 연결된 상태입니다.

    혹시나 해서 still 명령어로 한장 촬영해보면 모니터에 사진은 나타납니다.

    STRETCH DESKTOP과 파이캠 라이브러리와 충돌 문제가 있을까요?
    지금까지 막힘없이 다 풀었는데 카메라에서 막히네요 ㅜ.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2017.12.12 03:13 신고

      제가 테스트 했을 때와 달리 다음 줄에서 오래 대기하는 거 같군요.

      해당 줄을 제거하거나 대기 시간을 줄여보아도 될듯합니다.

      usleep(3000000);

  3. 무명 2017.12.12 12:40

    답변 감사드립니다.

    시도해 보겠습니다.

    제가 잘 몰라서 그러는데 파이선으로 OPENCV 구현하는 글이 네이버등에 많이 있는데 파이선으로
    OPENCV 구현 할때의 이점이 있나요?

    코드 줄이나 설치파일이 적어보이긴 하던데요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2017.12.12 14:09 신고

      파이썬이 속도에서 C++에 밀린다는 거 빼고는 여러가지로 좋은듯합니다.

      C++에 비해 짧은 코드로 구현이 되며 파이썬의 장점처럼 구현하기 쉽습니다.

      그리고 파이썬용 으로 배포되는 각종 라이브러리들을 사용해 볼 수도 있구요..

  4. 업무참고 2020.03.02 08:43

    안녕하세요. 게시글 보고 많은 도움받고 있습니다.
    다름이 아니고
    g++ picam.cpp -I/usr/local/include -lraspicam -lwiringPi 를 소스를 입력하여 컴파일 했더니

    icam -lwiringPi
    picam.cpp:5:10: fatal error: raspicam/raspicam.h: 그런 파일이나 디렉터리가 없습니다
    #include <raspicam/raspicam.h>
    ^~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    이런 문구가 뜹니다. 소스코드에 수정이 필요한건가요? 아니면 raspicam 이 설치 안된건지. 궁금합니다.
    내용중 http://webnautes.tistory.com/929 의 내용을 보고 설치까지는 완료 했지만
    #include <raspicam/raspicam.h>
    ^~~~~~~~~~~~~~~~~~~~~
    이 부분때문에 컴파일이 안됩니다.

    • 업무참고 2020.03.02 08:47

      참고로 제 환경운 라즈베리파이 4b+이며
      라즈비안 입니다.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.03.02 09:51 신고

      헤더파일이 어디에 설치되었나 find 명령으로 찾아조세요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.03.02 09:51 신고

      오타입니다. 찾아보세요

  5. 업무참고 2020.03.02 20:44

    /home/pi/raspicam-0.1.6/src 에 있던데 경로가 틀리나요? 헤더파일위치가 원래 어디인가요? 위에 적혀있는데로 했는데. 아마 설치중 오류때문인가봅니다.
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:46:9: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    set(CV_CAP_PROP_FORMAT,CV_8UC3);
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:46:9: note: suggested alternative: 'CV_CPU_FMA3'
    set(CV_CAP_PROP_FORMAT,CV_8UC3);
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp: In member function 'double raspicam::RaspiCam_Cv::get(int)':
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:92:14: error: 'CV_CAP_PROP_FRAME_WIDTH' was not declared in this scope
    case CV_CAP_PROP_FRAME_WIDTH :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:94:14: error: 'CV_CAP_PROP_FRAME_HEIGHT' was not declared in this scope
    case CV_CAP_PROP_FRAME_HEIGHT :
    ^~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:96:14: error: 'CV_CAP_PROP_FPS' was not declared in this scope
    case CV_CAP_PROP_FPS:
    ^~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:96:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_FPS:
    ^~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:98:14: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    case CV_CAP_PROP_FORMAT :
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:98:14: note: suggested alternative: 'CV_CPU_FMA3'
    case CV_CAP_PROP_FORMAT :
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:100:14: error: 'CV_CAP_PROP_MODE' was not declared in this scope
    case CV_CAP_PROP_MODE :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:100:14: note: suggested alternative: 'CV_CPU_NONE'
    case CV_CAP_PROP_MODE :
    ^~~~~~~~~~~~~~~~
    CV_CPU_NONE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:102:14: error: 'CV_CAP_PROP_BRIGHTNESS' was not declared in this scope
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:102:14: note: suggested alternative: 'MMAL_PARAMETER_BRIGHTNESS'
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_BRIGHTNESS
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:104:14: error: 'CV_CAP_PROP_CONTRAST' was not declared in this scope
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:104:14: note: suggested alternative: 'CV_CPU_POPCNT'
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    CV_CPU_POPCNT
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:106:14: error: 'CV_CAP_PROP_SATURATION' was not declared in this scope
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:106:14: note: suggested alternative: 'MMAL_PARAMETER_SATURATION'
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_SATURATION
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:109:14: error: 'CV_CAP_PROP_GAIN' was not declared in this scope
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:109:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:111:14: error: 'CV_CAP_PROP_EXPOSURE' was not declared in this scope
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:111:14: note: suggested alternative: 'RASPICAM_EXPOSURE'
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    RASPICAM_EXPOSURE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:116:14: error: 'CV_CAP_PROP_CONVERT_RGB' was not declared in this scope
    case CV_CAP_PROP_CONVERT_RGB :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:118:14: error: 'CV_CAP_PROP_WHITE_BALANCE_RED_V' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_RED_V:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:125:14: error: 'CV_CAP_PROP_WHITE_BALANCE_BLUE_U' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp: In member function 'bool raspicam::RaspiCam_Cv::set(int, double)':
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:143:14: error: 'CV_CAP_PROP_FRAME_WIDTH' was not declared in this scope
    case CV_CAP_PROP_FRAME_WIDTH :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:146:14: error: 'CV_CAP_PROP_FRAME_HEIGHT' was not declared in this scope
    case CV_CAP_PROP_FRAME_HEIGHT :
    ^~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:149:14: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    case CV_CAP_PROP_FORMAT :{
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:149:14: note: suggested alternative: 'CV_CPU_FMA3'
    case CV_CAP_PROP_FORMAT :{
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:162:14: error: 'CV_CAP_PROP_MODE' was not declared in this scope
    case CV_CAP_PROP_MODE ://nothing to do yet
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:162:14: note: suggested alternative: 'CV_CPU_NONE'
    case CV_CAP_PROP_MODE ://nothing to do yet
    ^~~~~~~~~~~~~~~~
    CV_CPU_NONE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:165:14: error: 'CV_CAP_PROP_BRIGHTNESS' was not declared in this scope
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:165:14: note: suggested alternative: 'MMAL_PARAMETER_BRIGHTNESS'
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_BRIGHTNESS
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:168:14: error: 'CV_CAP_PROP_CONTRAST' was not declared in this scope
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:168:14: note: suggested alternative: 'CV_CPU_POPCNT'
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    CV_CPU_POPCNT
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:171:14: error: 'CV_CAP_PROP_SATURATION' was not declared in this scope
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:171:14: note: suggested alternative: 'MMAL_PARAMETER_SATURATION'
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_SATURATION
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:175:14: error: 'CV_CAP_PROP_GAIN' was not declared in this scope
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:175:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:178:14: error: 'CV_CAP_PROP_EXPOSURE' was not declared in this scope
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:178:14: note: suggested alternative: 'RASPICAM_EXPOSURE'
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    RASPICAM_EXPOSURE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:186:14: error: 'CV_CAP_PROP_CONVERT_RGB' was not declared in this scope
    case CV_CAP_PROP_CONVERT_RGB :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:189:14: error: 'CV_CAP_PROP_WHITE_BALANCE_RED_V' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_RED_V:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:200:14: error: 'CV_CAP_PROP_WHITE_BALANCE_BLUE_U' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    make[2]: *** [src/CMakeFiles/raspicam_cv.dir/build.make:63: src/CMakeFiles/raspicam_cv.dir/raspicam_cv.cpp.o] 오류 1
    make[1]: *** [CMakeFiles/Makefile2:162: src/CMakeFiles/raspicam_cv.dir/all] 오류 2
    make: *** [Makefile:130: all] 오류 2
    pi@raspberrypi:~/raspicam-0.1.6/build $ sudo make install
    [ 35%] Built target raspicam
    [ 41%] Building CXX object src/CMakeFiles/raspicam_cv.dir/raspicam_cv.cpp.o
    In file included from /home/pi/raspicam-0.1.6/src/private/private_impl.h:46,
    from /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:39:
    /home/pi/raspicam-0.1.6/src/private/threadcondition.h:57:31: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    ThreadCondition() throw ( raspicam::Exception );
    ^~~~~
    /home/pi/raspicam-0.1.6/src/private/threadcondition.h:60:58: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    void Wait(std::unique_lock<std::mutex>& lck) throw ( raspicam::Exception );
    ^~~~~
    /home/pi/raspicam-0.1.6/src/private/threadcondition.h:64:30: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    void BroadCast() throw ( raspicam::Exception );
    ^~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp: In constructor 'raspicam::RaspiCam_Cv::RaspiCam_Cv()':
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:46:9: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    set(CV_CAP_PROP_FORMAT,CV_8UC3);
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:46:9: note: suggested alternative: 'CV_CPU_FMA3'
    set(CV_CAP_PROP_FORMAT,CV_8UC3);
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp: In member function 'double raspicam::RaspiCam_Cv::get(int)':
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:92:14: error: 'CV_CAP_PROP_FRAME_WIDTH' was not declared in this scope
    case CV_CAP_PROP_FRAME_WIDTH :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:94:14: error: 'CV_CAP_PROP_FRAME_HEIGHT' was not declared in this scope
    case CV_CAP_PROP_FRAME_HEIGHT :
    ^~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:96:14: error: 'CV_CAP_PROP_FPS' was not declared in this scope
    case CV_CAP_PROP_FPS:
    ^~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:96:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_FPS:
    ^~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:98:14: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    case CV_CAP_PROP_FORMAT :
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:98:14: note: suggested alternative: 'CV_CPU_FMA3'
    case CV_CAP_PROP_FORMAT :
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:100:14: error: 'CV_CAP_PROP_MODE' was not declared in this scope
    case CV_CAP_PROP_MODE :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:100:14: note: suggested alternative: 'CV_CPU_NONE'
    case CV_CAP_PROP_MODE :
    ^~~~~~~~~~~~~~~~
    CV_CPU_NONE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:102:14: error: 'CV_CAP_PROP_BRIGHTNESS' was not declared in this scope
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:102:14: note: suggested alternative: 'MMAL_PARAMETER_BRIGHTNESS'
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_BRIGHTNESS
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:104:14: error: 'CV_CAP_PROP_CONTRAST' was not declared in this scope
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:104:14: note: suggested alternative: 'CV_CPU_POPCNT'
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    CV_CPU_POPCNT
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:106:14: error: 'CV_CAP_PROP_SATURATION' was not declared in this scope
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:106:14: note: suggested alternative: 'MMAL_PARAMETER_SATURATION'
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_SATURATION
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:109:14: error: 'CV_CAP_PROP_GAIN' was not declared in this scope
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:109:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:111:14: error: 'CV_CAP_PROP_EXPOSURE' was not declared in this scope
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:111:14: note: suggested alternative: 'RASPICAM_EXPOSURE'
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    RASPICAM_EXPOSURE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:116:14: error: 'CV_CAP_PROP_CONVERT_RGB' was not declared in this scope
    case CV_CAP_PROP_CONVERT_RGB :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:118:14: error: 'CV_CAP_PROP_WHITE_BALANCE_RED_V' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_RED_V:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:125:14: error: 'CV_CAP_PROP_WHITE_BALANCE_BLUE_U' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp: In member function 'bool raspicam::RaspiCam_Cv::set(int, double)':
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:143:14: error: 'CV_CAP_PROP_FRAME_WIDTH' was not declared in this scope
    case CV_CAP_PROP_FRAME_WIDTH :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:146:14: error: 'CV_CAP_PROP_FRAME_HEIGHT' was not declared in this scope
    case CV_CAP_PROP_FRAME_HEIGHT :
    ^~~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:149:14: error: 'CV_CAP_PROP_FORMAT' was not declared in this scope
    case CV_CAP_PROP_FORMAT :{
    ^~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:149:14: note: suggested alternative: 'CV_CPU_FMA3'
    case CV_CAP_PROP_FORMAT :{
    ^~~~~~~~~~~~~~~~~~
    CV_CPU_FMA3
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:162:14: error: 'CV_CAP_PROP_MODE' was not declared in this scope
    case CV_CAP_PROP_MODE ://nothing to do yet
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:162:14: note: suggested alternative: 'CV_CPU_NONE'
    case CV_CAP_PROP_MODE ://nothing to do yet
    ^~~~~~~~~~~~~~~~
    CV_CPU_NONE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:165:14: error: 'CV_CAP_PROP_BRIGHTNESS' was not declared in this scope
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:165:14: note: suggested alternative: 'MMAL_PARAMETER_BRIGHTNESS'
    case CV_CAP_PROP_BRIGHTNESS :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_BRIGHTNESS
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:168:14: error: 'CV_CAP_PROP_CONTRAST' was not declared in this scope
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:168:14: note: suggested alternative: 'CV_CPU_POPCNT'
    case CV_CAP_PROP_CONTRAST :
    ^~~~~~~~~~~~~~~~~~~~
    CV_CPU_POPCNT
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:171:14: error: 'CV_CAP_PROP_SATURATION' was not declared in this scope
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:171:14: note: suggested alternative: 'MMAL_PARAMETER_SATURATION'
    case CV_CAP_PROP_SATURATION :
    ^~~~~~~~~~~~~~~~~~~~~~
    MMAL_PARAMETER_SATURATION
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:175:14: error: 'CV_CAP_PROP_GAIN' was not declared in this scope
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:175:14: note: suggested alternative: 'CV_PROP_RW'
    case CV_CAP_PROP_GAIN :
    ^~~~~~~~~~~~~~~~
    CV_PROP_RW
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:178:14: error: 'CV_CAP_PROP_EXPOSURE' was not declared in this scope
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:178:14: note: suggested alternative: 'RASPICAM_EXPOSURE'
    case CV_CAP_PROP_EXPOSURE :
    ^~~~~~~~~~~~~~~~~~~~
    RASPICAM_EXPOSURE
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:186:14: error: 'CV_CAP_PROP_CONVERT_RGB' was not declared in this scope
    case CV_CAP_PROP_CONVERT_RGB :
    ^~~~~~~~~~~~~~~~~~~~~~~
    /home/pi/raspicam-0.1.6/src/raspicam_cv.cpp:189:14: error: 'CV_CAP_PROP_WHITE_BALANCE_RED_V' was not declared in this scope
    case CV_CAP_PROP_WHITE_BALANCE_RED_V:



    make 중 이부분에서 빠란 에러가 상당히 많이 나왔습니다.

    친절한 답변 감사합니다.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.03.03 09:58 신고

      설치가 안된듯합니다. 원래는 포스팅에 언급된 위치에 있어야 합니다

      그리고 OpenCV 4.x에서 C API가 제거되어서 OpenCV 3.x를 사용해야 합니다

  6. 업무참고 2020.03.03 10:29

    네 그렇군요 감사합니다.. opencv3.x 로 설치 진행해보도록 하겠습니다.

+ Recent posts