Ask Your Question

Marcofe's profile - activity

2017-07-05 14:26:21 -0600 asked a question Cannot print cv::Size with std::cout

I want to print the size of a cv::Mat object on the terminal, so something like

    cv::Mat src0;
    src0 = cv::imread(frame0Path,CV_LOAD_IMAGE_GRAYSCALE);
    std::cout << src0.size() << std::endl;

I did that a lot of times in other applications and correctly worked. However, in the new application I'm writing now I end up with the following build error

no match for ‘operator<<’ in ‘std::cout << cv::Mat::MSize::operator()() const()’

The image is correctly loaded, because I can display it through cv::imshow. I'm completely get mad because, as I said, I did that a lot of times in different applications. Am I linking a wrong library or something liike that? Thank you for your help

2017-05-11 04:28:17 -0600 asked a question Curvature-based corner detection algorithm

Hi everyone,

I wonder if OpenCV implements a curvature-based corner detection algorithm (Harris does not seem to be so, correct me if I'm wrong), or if and how it can be easily implemented with existing methods. In particular, my purpose would concern a splitting of the image contours (returned, e.g., by cv::findContours()) in sub-contours, according to their curvature.
Can anyone help me? Thanks in advance

2017-03-17 11:37:40 -0600 received badge  Enthusiast
2016-11-25 02:59:25 -0600 asked a question Is it possible to run ROS Kinetic with OpenCV 2.4.X?

Hi everyone, I have ROS Kinetic on Ubuntu 16.04. As stated in the documentation, it is supported by OpenCV 3.1, while all the previous ROS versions are supported by OpenCV 2.4.

I would like to run my ROS nodes by linking my 2.4.13 OpenCV libraries, so I linked them in the CMakeLists.txt of my packages, in place of the 3.1 libraries present in ROS. However, when I launch a pair of image publisher and subscriber, the subscriber crashes for segmentation fault in the callback, during the conversion of the image (when a copyTo() is internally called) or with imshow().

I wonder if this a compatibility issue (i.e., Kinetic and Opencv 2.4 cannot work together at all), or it can be related to some coding mistakes. A friend of mine tried to run a node with ROS Indigo and OpenCV 3.1, and it fell in the same problem. That's why I'm afraid it is due to compatibility reasons.

Any help or comment is appreciated. Thanks a lot.

2016-07-09 12:28:30 -0600 asked a question Crash apparently occurred on cv::gpu::GpuMat::upload()

My application occasionally crashes with the following error message:

_int_malloc: Assertion `(bck->bk->size & 0x4) == 0' failed.

I am on Ubuntu 12.04, so I ran the application again with gdb. When the crash occurs, this is the bt output:

0 0x00007fffeedb8035 in raise () from /lib/x86_64-linux-gnu/

1 0x00007fffeedbb79b in abort () from /lib/x86_64-linux-gnu/

2 0x00007fffeedfefed in ?? () from /lib/x86_64-linux-gnu/

3 0x00007fffeee02500 in ?? () from /lib/x86_64-linux-gnu/

4 0x00007fffeee03e85 in malloc () from /lib/x86_64-linux-gnu/

5 0x00007fff8f38f56b in ?? () from /usr/lib/x86_64-linux-gnu/

6 0x00007fff8f393115 in ?? () from /usr/lib/x86_64-linux-gnu/

7 0x00007fff8f39352a in ?? () from /usr/lib/x86_64-linux-gnu/

8 0x00007fff8f2de77a in ?? () from /usr/lib/x86_64-linux-gnu/

9 0x00007fff8f2df310 in ?? () from /usr/lib/x86_64-linux-gnu/

10 0x00007fff8f2ac33a in cuMemAllocPitch_v2 () from /usr/lib/x86_64-linux-gnu/

11 0x00007fffe7c842d2 in ?? () from /usr/local/cuda/lib64/

12 0x00007fffe7c674c6 in ?? () from /usr/local/cuda/lib64/

13 0x00007fffe7c94278 in cudaMallocPitch () from /usr/local/cuda/lib64/

14 0x00007fffefa40305 in CudaFuncTable::mallocPitch(void*,unsigned long, unsigned long, unsigned long) const () from /usr/local/lib/

15 0x00007fffefa3c34c in cv::gpu::GpuMat::create(int, int, int)() from /usr/local/lib/

16 0x00007fffefa3c502 in cv::gpu::GpuMat::upload(cv::Mat const&) () from /usr/local/lib/

17 0x0000000000483fb3 in of_driving::computeOpticalFlowField (this=0xa4a710, prevImg=..., img=...) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/of_driving.cpp:570

18 0x0000000000483360 in of_driving::run (this=0xa4a710, img=..., prev_img=..., save_video=false, rec=true, move_robot=true) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/of_driving.cpp:421

19 0x0000000000476bf7 in potentialNavigationNAO::run(this=0xa4a280) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/potentialNavigationNAO.cpp:396

20 0x000000000047e093 in AL::detail::ALFunctor_0<potentialnavigationnao, void="">::call (this=0xa6e690) at /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/include/alcommon/detail/alfunctorwithoutreturn.h:32

21 0x00007ffff079937a in AL::ALModuleCoreImpl::execute(std::string const&, AL::ALValue const&, AL::ALValue&)() from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

22 0x00007ffff07e4cee in AL::ALBrokerImpl::methodCall(std::string const&, std::string const&, AL::ALValue const&, AL::ALValue&) ()
from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

23 0x00007ffff07be206 in AL::albroker__callNaoqi(soap*, std::string, std::string, AL::ALValue, AL::albroker__callNaoqiResponse&) ()
from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

24 0x00007fffeeb69d9b in AL::soap_serve_albroker__callNaoqi(soap*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

25 0x00007fffeeb6d2e4 in AL::soap_serve(soap*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

26 0x00007ffff07d7914 in AL::process_request::run() () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

27 0x00007fffee6ecbbb in AL::ALThread::runTask() () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/

28 0x00007fffee6ee661 in AL::_AL_Thread_Pool_Atom(void*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14 ...

2016-02-29 07:50:22 -0600 commented question OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0

If you refer to opencv, I built the 2.4.11 version available on the website, I did not download it from git, if this is what you asked. This is the point: CMake output tells me that CUDA is detected, but when I run some program that should use gpu, the execution fails as it was not present

2016-02-29 07:32:37 -0600 commented answer OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0

Yeah, I tried, it's not. Running deviceQuery this is the output message:

./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38 -> no CUDA-capable device is detected Result = FAIL

2016-02-28 05:07:07 -0600 commented question OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0

I followed this tutorial ( to add the NVIDIA drivers for 12.04, because the standard drivers intallation with the .run file downloaded from nvidia website fails. Btw, I have already enabled CUDA on OpenCV in the past on this pc, but I was on Ubuntu 14.04. Now I need to work on Ubuntu 12.04 and I met this problem, so yes, I have a CUDA capable device. My GPU is an NVIDIA GeForce GTX 850M

2016-02-26 12:04:00 -0600 asked a question OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0

Building OpenCV, the cmake output is

General configuration for OpenCV 2.4.11 =====================================
Version control:               unknown
Host:                        Linux 3.13.0-79-generic x86_64
CMake:                       2.8.7
CMake generator:             Unix Makefiles
CMake build tool:            /usr/bin/make
Configuration:               RELEASE

Built as dynamic libs?:      YES
C++ Compiler:                /usr/bin/c++  (ver 4.6)
C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
C Compiler:                  /usr/bin/gcc
C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
Linker flags (Release):      
Linker flags (Debug):        
Precompiled headers:         YES

OpenCV modules:
To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab
Disabled:                    world
Disabled by dependency:      -
Unavailable:                 androidcamera dynamicuda java viz

QT 4.x:                      YES (ver 4.8.1 EDITION = OpenSource)
QT OpenGL support:           YES (/usr/lib/x86_64-linux-gnu/
OpenGL support:              YES (/usr/lib/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib/x86_64-linux-gnu/
VTK support:                 NO

Media I/O: 
ZLib:                        /usr/lib/x86_64-linux-gnu/ (ver
JPEG:                        /usr/lib/x86_64-linux-gnu/ (ver )
PNG:                         /usr/lib/x86_64-linux-gnu/ (ver 1.2.46)
TIFF:                        /usr/lib/x86_64-linux-gnu/ (ver 42 - 3.9.5)
JPEG 2000:                   /usr/lib/x86_64-linux-gnu/ (ver 1.900.1)
OpenEXR:                     build (ver 1.7.1)

Video I/O:
DC1394 1.x:                  NO
DC1394 2.x:                  YES (ver 2.2.0)
FFMPEG:                      YES
  codec:                     YES (ver 53.35.0)
  format:                    YES (ver 53.21.1)
  util:                      YES (ver 51.22.3)
  swscale:                   YES (ver 2.1.0)
  gentoo-style:              YES
GStreamer:                   NO
OpenNI:                      NO
OpenNI PrimeSensor Modules:  NO
PvAPI:                       NO
GigEVisionSDK:               NO
UniCap:                      NO
UniCap ucil:                 NO
V4L/V4L2:                    NO/YES
XIMEA:                       NO
Xine:                        NO

Other third-party libraries:
Use IPP:                     NO
Use Eigen:                   NO
Use TBB:                     YES (ver 4.0 interface 6000)
Use OpenMP:                  NO
Use GCD                      NO
Use Concurrency              NO
Use C=:                      NO
Use Cuda:                    YES (ver 5.5)
Use OpenCL:                  YES

Use CUFFT:                   YES
Use CUBLAS:                  YES
USE NVCUVID:                 NO
NVIDIA GPU arch:             11 12 13 20 21 30 35
NVIDIA PTX archs:            30
Use fast math:               YES

Version:                     dynamic
Include path:                /home/ubu1204/Documents/Software/opencv-2.4.11/3rdparty ...
2015-11-20 05:35:48 -0600 asked a question Get intermediate optical flow levels with calcOpticalFlowPyrLk

Hi all, I'm using the function calcOpticalFlowPyrLK() to compute the optical flow between a pair of two subsequent images, by passing a corresponding pair of pyramids built with buildOpticalFlowPyramid(). I see that the output of the function is the final optical flow field corresponding to the lowest layer (=highest resolution) of the pyramid, as integration of the optical flows computed in the previous layers. My question is the following: is there a way to get also these intermediate optical flows fields, one for each level of the pyramid? Thanks