Ask Your Question

Matheus Galvez's profile - activity

2018-04-24 09:12:34 -0600 received badge  Notable Question (source)
2017-03-05 16:26:13 -0600 received badge  Popular Question (source)
2016-04-15 13:04:15 -0600 received badge  Notable Question (source)
2015-02-18 09:37:35 -0600 received badge  Popular Question (source)
2014-06-05 10:52:06 -0600 received badge  Student (source)
2013-06-06 16:12:47 -0600 asked a question Error NetBeans Compiling OpenCV Code

Hi all, I am trying to compile a code using OpenCV 2.3 installed directly from Synaptic Packet Manager, for I was trying to compile the latest version and installing by myself being unable so far.

When I try to compile, however, an old error comes out, and it is that when I try to use some functions such as cv::imwrite() I get an "unable to resolve imwrite()" error. I was receiving the same error some days ago when I had the latest version installed and compiled in my machine. Now, the error seems to be the same, but with a huge message. This what NetBeans returns to me:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf

make[1]: Entering directory /home/matheus/NetBeansProjects/BeadTracker' rm -f -r build/Debug rm -f dist/Debug/GNU-Linux-x86/beadtracker make[1]: Leaving directory/home/matheus/NetBeansProjects/BeadTracker'

CLEAN SUCCESSFUL (total time: 54ms)

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory /home/matheus/NetBeansProjects/BeadTracker' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/beadtracker make[2]: Entering directory/home/matheus/NetBeansProjects/BeadTracker' mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/GeneralException.o.d g++ -c -g pkg-config --cflags libavcodec pkg-config --cflags libavdevice pkg-config --cflags libavfilter pkg-config --cflags libavformat pkg-config --cflags libavutil pkg-config --cflags libswresample pkg-config --cflags libswscale pkg-config --cflags libpostproc pkg-config --cflags opencv -MMD -MP -MF build/Debug/GNU-Linux-x86/GeneralException.o.d -o build/Debug/GNU-Linux-x86/GeneralException.o GeneralException.cpp mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/OpenVideoException.o.d g++ -c -g pkg-config --cflags libavcodec pkg-config --cflags libavdevice pkg-config --cflags libavfilter pkg-config --cflags libavformat pkg-config --cflags libavutil pkg-config --cflags libswresample pkg-config --cflags libswscale pkg-config --cflags libpostproc pkg-config --cflags opencv -MMD -MP -MF build/Debug/GNU-Linux-x86/OpenVideoException.o.d -o build/Debug/GNU-Linux-x86/OpenVideoException.o OpenVideoException.cpp mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/ReadException.o.d g++ -c -g pkg-config --cflags libavcodec pkg-config --cflags libavdevice pkg-config --cflags libavfilter pkg-config --cflags libavformat pkg-config --cflags libavutil pkg-config --cflags libswresample pkg-config --cflags libswscale pkg-config --cflags libpostproc pkg-config --cflags opencv -MMD -MP -MF build/Debug/GNU-Linux-x86/ReadException.o.d -o build/Debug/GNU-Linux-x86/ReadException.o ReadException.cpp mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/VideoInterface.o.d g++ -c -g pkg-config --cflags libavcodec pkg-config --cflags libavdevice pkg-config --cflags libavfilter pkg-config --cflags libavformat pkg-config --cflags libavutil pkg-config --cflags libswresample pkg-config --cflags libswscale pkg-config --cflags libpostproc pkg-config --cflags opencv -MMD -MP -MF build/Debug/GNU-Linux-x86/VideoInterface.o.d -o build/Debug/GNU-Linux-x86/VideoInterface.o VideoInterface.cpp mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/main.o.d g++ -c -g pkg-config --cflags libavcodec pkg-config --cflags libavdevice pkg-config --cflags libavfilter pkg-config --cflags libavformat pkg-config --cflags libavutil pkg-config --cflags libswresample pkg-config --cflags libswscale pkg-config --cflags libpostproc pkg-config --cflags opencv -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp mkdir -p dist/Debug/GNU-Linux-x86 g++ -o dist/Debug/GNU-Linux-x86/beadtracker ... (more)

2013-06-06 15:00:36 -0600 asked a question Error -fPIC while compiling OpenCV

Hi all,

I am stumbling for the whole week in this annoying error I am getting while trying to compile OpenCV again. Some weeks ago I had compiled it correctly, but now I don't know what is happening at all.

Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: /home/matheus/ffmpeg_build/lib/../lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /home/matheus/ffmpeg_build/lib/../lib/libavcodec.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: * [lib/libopencv_highgui.so.2.4.5] Error 1 make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: ** [all] Error 2

Could anyone help me?

2013-05-28 15:40:00 -0600 commented question Constants not found under Linux

I did different to solve it. I downloaded the .tar.bz file containing the latest version directly from the opencv website. I recompiled and installed again. Now it works properly.

2013-05-28 15:06:01 -0600 received badge  Organizer (source)
2013-05-28 14:57:26 -0600 asked a question Constants not found under Linux

Hi all,

I am trying to compile some simple OpenCV code for Linux Ubuntu. I have installed today the library under my Linux machine using this tutorial. After doing so successfully I tried to execute some code from the reference manual. The code is the following:

include <cstdlib>

include <iostream>

include <opencv2/opencv.hpp>

include <opencv2/opencv_modules.hpp>

using namespace cv; using namespace std;

int main(int argc, char** argv) {
VideoCapture cap(0); // open the default camera

if(!cap.isOpened()) // check if we succeeded
    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;

}

It can be found at page 326 of the manual.

For some reason I am getting the following error: main.cpp:28:32: error: ‘CV_BGR2GRAY’ was not declared in this scope

I tried to compile similar codes, using other constants prefixed by CV_ and the same happens all the time. Curiously I have brought this code from a Windows machine where I downloaded and installed OpenCV, configured Visual Studio 2010 to recognize it and compiled the code without problems. Can someone tell me what is happening?

Thank you all!

2013-05-24 10:38:00 -0600 commented answer videocapture not working with uncompressed files

Hi Pierre,

Right now I am having the same problem when reading uncompressed videos. I understood the idea of your code but I would like to know something else about the do-while loop where you jump the header. First what is that string named 'tag'? Since my video does not contain this string I am getting and error when trying to read it. Thank you!