Ask Your Question

lakehanne's profile - activity

2017-05-15 00:33:24 -0600 received badge  Enthusiast
2017-05-14 23:48:14 -0600 received badge  Scholar (source)
2017-05-14 23:23:16 -0600 asked a question convert kinect rgb to gray

With the opencv python bindings, it should be straightforward to convert from rgb to grayscale using

frame_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY); but I find that my implementation always throws errors

frame_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV); cv2.error: /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/imgproc/src/color.cpp:9710: error: (-215) depth == CV_8U || depth == CV_16U || depth == CV_32F in function cvtColor

The rgb is generated from kinect rgb frames using the opencv 3.x python examples. What could I be missing?

Frame is a numpy.ndarray of shape (480, 640, 3)

2017-05-06 23:36:06 -0600 received badge  Editor (source)
2017-05-06 23:31:31 -0600 asked a question using setMouseCallback function

Hi,

I am trying to record the coordinates of clicked points on an opencv image . I am using the setMouseCallback function pointer as a method to trigger mouse events when I need to record these coordinates. I am running into errors binding to the mouse callback function in a class. The problem goes like this:

void CoordinatesPicker::mouseClick(int event, int x, int y, int flags, void* )
{
  /* handle vents and callbacks */
}

void CoordinatesPicker::onMouse(int event, int x, int y, int flags, void* param)
{
    CoordinatesPicker* ptr = reinterpret_cast<CoordinatesPicker*>(param);
    ptr->mouseClick( event, x, y, flags, 0 );
}

void CoordinatesPicker::get_points(cv::Mat&& img, const std::string& title, vector<cv::Point3d> &pts)
{
   draw_title = title;                         //draw_title is a private member function
  setMouseCallback(title, &CoordinatesPicker::onMouse, this);
  imshow(title, draw_img);            //draw_img is a private member function
  destroyAllWindows();
  pts = draw_pts3d;                     //draw_pts3d is a private member funtion
}

But when I run the code, it says

error: cannot convert ‘void (CoordinatesPicker::*)(int, int, int, int, void*)’ to ‘cv::MouseCallback {aka void (*)(int, int, 
int, int, void*)}’ for argument ‘2’ to ‘void cv::setMouseCallback(const cv::String&, cv::MouseCallback, void*)’
 setMouseCallback(title, &CoordinatesPicker::onMouse, this);

Trying to bind to the function pointer doesn't help either.

What am I possibly missing?

2017-03-13 22:41:34 -0600 received badge  Notable Question (source)
2017-02-17 12:44:06 -0600 received badge  Popular Question (source)
2015-08-26 13:56:46 -0600 asked a question Undefined reference to TIFFReadDirectory@LIBTIFF_4.0

Hi there,

I am running opencv 2.4.8 compiled from source with the following options enabled in cmake:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_OPENGL=ON -D WITH_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_OPENNI=ON -D WITH_OPENMP=ON -D WITH_OPENCL=ON -D WITH_OPENGL=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler -D WITH_TIFF=ON ../ I am running two applications that run opencv simultaneously. One used the kinect Xbox camera while the other uses the kinect2 ToF camera. The xbox code runs fine but I find that the kinect2 does not compile as it fets linking errors with libtiff_4.0. Now, before I installed opencv with cuda option, I had both programs running smoothly with no error from opencv. But once I got opencv with cuda installed, I ran into issues with the linking during compilation for the kinect2 code. Here is the output for kinect2:

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFIsTiled@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFOpen@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFGetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFClose@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0' collect2: error: ld returned 1 exit status make[2]: *** [/home/lex/catkin_ws/devel/lib/kinect2_calibration/kinect2_calibration] Error 1 make[1]: *** [iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFIsTiled@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFOpen@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFGetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference ... (more)

2015-07-27 11:07:57 -0600 answered a question Run Asus Xtion with HighGUI - HOWTO?!

Put this debugging line, cout << cv::getBuildInformation() << endl;, in your code, right before

if( !capture.isOpened() )
{
    cout << "Can not open a capture object." << endl;
    return -1;
}

That will let you know if your opencv is installed with openni. If switches,

OpenNI:                      YES (ver 1.5.4, build 0)
OpenNI PrimeSensor Modules:  YES (/usr/lib/libXnCore.so)

are NO in your case, then you might want to consider recompiling your opencv modules with the cmake flag -D WITH_OPENNI=ON.

Cheers!