Ask Your Question

ChanKim's profile - activity

2019-12-17 22:32:35 -0600 asked a question ubuntu 16.04, "VIDEOIO(V4L2:/dev/video0): can't open camera by index" after software update

ubuntu 16.04, "VIDEOIO(V4L2:/dev/video0): can't open camera by index" after software update I have opencv 3.4 installed

2016-02-23 09:30:32 -0600 asked a question Can't find camera on CentOS 6.7

Hi, I'm using CentOS6.7(final), I installed opencv using yum install opencv. (I checked camera ok with opencv on CentOS6.6 last summer, I upgraded to CentOS6.7 later) To try camera interface, I tried compiling this test.cpp file below. (I copied the test file from http://docs.opencv.org/2.4/modules/hi...)

#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened()){  // check if we succeeded
        cout << "no camera found\n";
        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;
}

Below is the Makefile I used.

[code]CC            = gcc
CXX           = g++
CFLAGS        = -m64 -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS      = -m64 -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT $(DEFINES)
LINK          = g++
LFLAGS        = -m64 -Wl,-O1

INCPATH = -I.
INCPATH += -I/usr/include
INCPATH += -I/usr/local/include
INCPATH += -I/usr/local/include/opencv
INCPATH += -I/usr/local/include/opencv2

LIBS  = /usr/local/lib/libopencv_highgui.so
LIBS += /usr/local/lib/libopencv_core.so
LIBS += /usr/local/lib/libopencv_imgproc.so
LIBS += /usr/local/lib/libopencv_objdetect.so
LIBS += /usr/local/lib/libopencv_contrib.so


SOURCES       = test.cpp
OBJECTS       = $(SOURCES:.cpp=.o)
TARGET        = image_show

$(TARGET) : $(OBJECTS)
    $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

$(OBJECTS) : $(SOURCES)
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

clean:
    -rm -f $(OBJECTS) *~ core *.core[/code]

I tried using the camera (it supports UVC : USB Video Class spec.) and I could see the camera is working using 'cheese' program on CentOS6.7. (Though I had to do : chmod go+rwx /dev/video0) So the OS has detected the camera ok. When I run the program, it's like below.

ckim@stph45:~/testopencv] image_show
no camera found

Can someone tell me what's wrong?

2013-05-24 05:42:44 -0600 received badge  Taxonomist
2012-09-21 04:51:59 -0600 asked a question 1>c:\opencv2.1\include\opencv\cxcore.hpp(2162): error C2059: syntax error : 'string'

When I compile my project I get the error message shown below 1>c:\opencv2.1\include\opencv\cxcore.hpp(2162): error C2059: syntax error : 'string' 1>c:\opencv2.1\include\opencv\cxcore.hpp(2162): error C3805: 'string': unexpected token, expected either '}' or a ',' 1>c:\opencv2.1\include\opencv\cxoperations.hpp(1890): error C2065: 'NAMED' : undeclared identifier The source code of cxcore.hpp is like this. class CV_EXPORTS FileNode { public: enum { NONE=0, INT=1, REAL=2, FLOAT=REAL, STR=3, STRING=STR, REF=4, SEQ=5, MAP=6, TYPE_MASK=7, FLOW=8, USER=16, EMPTY=32, NAMED=64 }; error occurs from EMPTY=32. My project is setup for Multi-byte character. Any idea to solve this problem? Please someone explain why this is happening. Thanks in advance. Chan

2012-08-30 02:47:39 -0600 asked a question how to find rectifying matrix using OpenCV

I'm not an expert in this area yet. I have a weak understanding in computer vision so it's hard to grasp things from the document. I have a rather urgent job to do which is to find two matrices which rectifies the stereo images, left and right. I want to find matrix HL and HR such that multiplying HL to the coordinate of left image sends it to the new coordinate in the rectified left image. HR, the same for the right image. Please someone tell me which is the normal way to do this using OpenCV. I know H can be calcuated from F(fundamental matrix). But please tell me the method from the image pair to the H matrices.. Thanks in advance!