Ask Your Question

namiqaliyev's profile - activity

2018-11-21 15:42:55 -0600 received badge  Popular Question (source)
2017-12-18 03:54:40 -0600 received badge  Student (source)
2017-09-30 02:00:50 -0600 received badge  Notable Question (source)
2016-10-07 05:14:12 -0600 received badge  Popular Question (source)
2015-03-27 13:14:04 -0600 asked a question WebCam using error with opencv and c++

There is a c++ code for capturing from webcam. This is a code.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    VideoCapture vid(0);
    if(!vid.isOpened()){
        cout<<"Camera could not load..."<<endl;
        return -1;
    }
    namedWindow("webcam",CV_WINDOW_AUTOSIZE);
    while(1){
        Mat frame;
        bool ctrl = vid.read(frame);
        imshow("webcam",frame);
        if(waitKey(0) == 27){
            cout<<"The app is ended..."<<endl;
            break;
        }
    }
    return 0;
}

But when I try to compile it : g++ webcam.cpp -lopencv_core -lopencv_highgui it raises an error

/tmp/ccApncrK.o: In function `main':
webcam.cpp:(.text+0x1a): undefined reference to `cv::VideoCapture::VideoCapture(int)'
webcam.cpp:(.text+0x26): undefined reference to `cv::VideoCapture::isOpened() const'
webcam.cpp:(.text+0xc3): undefined reference to `cv::VideoCapture::read(cv::_OutputArray const&)'
webcam.cpp:(.text+0x195): undefined reference to `cv::VideoCapture::~VideoCapture()'
webcam.cpp:(.text+0x1f7): undefined reference to `cv::VideoCapture::~VideoCapture()'
collect2: error: ld returned 1 exit status

Can you help me, please. PS. (I am using Ubuntu...)

2015-03-27 13:05:34 -0600 commented question compile time errors in openCV/C++ code.

But it does not show the picture.....

2015-03-27 12:50:21 -0600 asked a question compile time errors in openCV/C++ code.

I have a openCV & c++ code like below.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    Mat res(720,502,CV_8UC3,Scalar(0,255,255));
    vector<int> sparam;
    sparam.push_back(CV_IMWRITE_JPEG_QUALITY);
    sparam.push_back(80);
    imwrite("/home/namiq/Pictures/IMG.JPG",res,sparam);
    namedWindow("Open Picture",CV_WINDOW_AUTOSIZE);
    imshow("Open Picture",res);
    waitKey(0);
    destroyWindow("Open Picture");
    return 0;
}

When I do g++ openpic.cpp -lopencv_core -lopencv_highgui for compile, it gives an error

/usr/bin/ld: /tmp/ccYxhFYr.o: undefined reference to symbol '_ZN2cv7imwriteERKNS_6StringERKNS_11_InputArrayERKSt6vectorIiSaIiEE'
//usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

What is the problem. I am new in OPENCV, and I get many errors in c++...

2015-03-27 10:48:09 -0600 asked a question Compiling c++ code give an error "‘nameWindow’ was not declared in this scope"

I have a cpp code like below.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    Mat img(480,640,CV_8UC3,Scalar(255,0,0));
    if(img.empty())
    {
        cout<<"Picture can not load..."<<endl;
        return -1;
    }
    nameWindow("test",CV_WINDOW_AUTOSIZE);
    imshow("test",img);
    waitKey(0);
    destroyWindow("test");
    return 0;
}

When I try to compile this code like below

g++ resimac.cpp

it gives an error

error: ‘nameWindow’ was not declared in this scope
  nameWindow("test",CV_WINDOW_AUTOSIZE);
                                      ^

So what is the problem? How to solve it?