Ask Your Question

Jesus's profile - activity

2017-10-24 20:25:16 -0600 received badge  Popular Question (source)
2017-03-17 07:39:42 -0600 received badge  Famous Question (source)
2015-12-06 01:43:26 -0600 received badge  Notable Question (source)
2015-11-11 20:06:28 -0600 received badge  Student (source)
2015-06-09 15:42:12 -0600 received badge  Popular Question (source)
2014-12-05 05:50:17 -0600 asked a question Detect when the ipCamera is unplugged opencv

I aware that this is a topic, but I tried many solutions and for me it does not works, for that I put my specific case. I am working with an Ipcamera, and I have this code in C++:

cv::VideoCapture cap("http://127.0.0.1:80/videostream.cgi?resolution=320x240&rate=0& user=admin&pwd=admin&.mjpg");
        //while we keep connected to the ip camera, we process the frames we receive
            if (!cap.isOpened())
            {
                cout<<"NO INTERNET"<<endl;

                //cap.release();
                fallo=true;
                v1=0;
                pthread_exit(NULL);

            }

                while ( cap.isOpened())
                {
                    //we get the frame from the ip camera
                    //cap.read(frame);
                    if(fallo==true)
                        fallo=false;

                    cv::Mat3b frame;

                    if(!cap.read(frame))
                    {
                         cout << "UNPLUGGED";
                         cout << "UNPLUGGED";
                         pthread_exit(NULL);
                    }

                    cap >> frame;

                    //if the frame is empty we break
                    if(frame.empty()) break;

                    //we show the video frame in "video" window
                    cv::imshow("Front", frame);

                    if(v1 == 1){
                        v1 = 0;
                        pthread_exit(NULL);
                    }

                    //To close the window
                    if(cv::waitKey(20) >= 0) break;
                }
}

What I want is to know when the camera is unplugged, because I want to release the thread for throw another camera without problems. But is imposible detected it.

I tried with this:

if(!cap.read(frame))

But nothing, I tried to put an cout after while but also nothing happend, and even I tried to put the while inside of a trybut again nothing.

My question is How can I detect that the camera is disconnected?

Many Thanks

2014-10-28 12:35:41 -0600 asked a question Run script at boot Ubuntu

Hello guys,

I am pretty new doing script in Ubuntu, I have an application in C++ which uses opencv for Ipcamera video processing, I am working in Ubuntu 14.0.4.

I am going to try to explain what I did:

  • First I wanted to check if a script could be called in the boot, so I created this simple script which only create a file in the same directory in which I have my script:
#!/bin/sh


RUTA_ENTORNO=`dirname $0`

echo "Creando archivo de prueba..."
touch ${RUTA_ENTORNO}/ArchivoPrueba.txt
exit 0

I add into the rc.local the next line:

sh /home/myScript

And when I reboot my computer the file it was created, so perfect.

Then I compiled my application, and I move the executable in the same folder of my Script, and I add this:

#!/bin/sh

/home/executable
RUTA_ENTORNO=`dirname $0`

echo "Creando archivo de prueba..."
touch ${RUTA_ENTORNO}/ArchivoPrueba.txt
exit 0

I added the "/home/executable" line in my Script for executed it, and for check if after this the file.txt it is created.

But here is what I do not undestand, when I reboot my system the camera is not running, it seems that the aplication is not throw, but the file.txt is created, however if in the terminal I type this "sh /home/myScript" the aplication start and I can see the camera, but the file.txt is not created.

How can I run my aplication in automatic way when I reboot my system?

Many thanks

2014-10-08 11:29:31 -0600 asked a question Install opencv in Ubuntu 64 bits

Hello guys,

I am following this tutorial for install opencv in my Ubuntu:

http://docs.opencv.org/opencv_tutorials.pdf

I finish the installation, but when I try my program I have some errors.

My question is that can I follow this tutorial for ubuntu 64 bits? or I need to do anything else.

Many thanks

2014-08-21 07:18:38 -0600 commented question Ipcamera serve to a multiple viewers

HI berak, I am going to need five client watching the same ipcamera, I can not use aPC like a server, because is a embedded system, the whole system. What I cannot undestand is if this cameras can provided for many client why I can not get the propertly quality?

2014-08-21 06:59:31 -0600 commented question Ipcamera serve to a multiple viewers

Hello berak thank you for you quick answer. To be honest I am not sure, the thing is that if I run the application just in one board, it seems that everything is ok, but when I try to run in two start come the decoding problem. The thing is that the first application show the camera, and say the second application which camera should to show (always is the same camera), and the second application fetch the video camera like do the first application. But after few seconds the second application start with the problems. I am not sure if I explain propertly

2014-08-21 06:20:20 -0600 asked a question Ipcamera serve to a multiple viewers

Hello guys,

I am working in an application in an embedded linux. I have to work with many boards, my application is goign to run in every board. My problem is that my application use the opencv libraries and fetch the video from an Ipcamera rtsp protocol, the thing that when I run my application in each board, I have many viewers for access to the same ipcamera, then I have some decoding error, because there is many viewer trying to fetch the video.

There is some way to do this for example if in one of my board I fetch the video, and the other board just read from this??or maybe like a server?

I do not know have idea of how can I do this.

Thank so much

2014-08-21 06:16:11 -0600 commented question Opencv static link error

Hi Stefan, look finally I give up, and I used the buildroot for created a sysroot with every libraries which I needed. Then I installed it and everything work propertly

2014-07-03 04:55:20 -0600 asked a question Problem for build opencv libraries with CMkake

Hi guys I am not an expert I have an problem with the cross-compilation of opencv for ARM.

My problem is that when I build the libraries with the Cmake it finish propertly but this is the output:

GUI: 
--     QT 4.x:                      NO
--     GTK+ 2.x:                    NO
--     GThread :                    NO
--     GtkGlExt:                    NO
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 62)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO
--       gentoo-style:              YES

The opencv libraries are build good, but the GTK for example it seems that is not build. Anyways I tried to compile my .cpp file which use the opencv libraries, I compile it like this:

 arm-linux-g++ -static -o exampleWindows IPCamera.cpp `pkg-config --cflags --libs opencv`

It compile without problem and I get the executable in ARM format, and with staic linker(as I want), but when I try to run in my ARM I get this error:

 OpenCV Error: Unspecified error (The function is not implemented. 
 Rebuild the library with Windows, GTK+ 2.x or Carbon support. 
 If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, 
 then re-run cmake or configure script) in cvNamedWindow, 
 file /home/jesus/opencv/opencv/modules/highgui/src/window.cpp, line 483
 terminate called after throwing an instance of 'cv::Exception'
 what():  /home/jesus/opencv/opencv/modules/highgui/src/window.cpp:483: error: (-2)    
 The function is not implemented.

So obviously I need to build the Cmake with this library but I do not know if I have to indicate the PATH for indicate where are this library in my PC when I build the CMake.

This is my command for build the CMake:

cmake -D SOFTFP=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=DEBUG -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 OPENCV_BUILD_3RDPARTY_LIBS=ON -D WITH_FFMPEG=ON -D WITH_GTK=ON -D WITH_OPENEXR=ON -D WITH_OPENNI=ON -D WITH_PNG=ON -D WITH_TBB=ON -D WITH_XINE=ON -D WITH_GSTREAMER=ON -D CMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv

Thank you so much.

2014-06-26 10:39:37 -0600 received badge  Editor (source)
2014-06-26 03:51:43 -0600 asked a question ARM opencv Linker Error

I hope someone can help me. I have a c++ file which use opencv libraries. I need to get an executable for an ARM in which I have to run it. My executable should be compile in a static linker way.

I am not an exepert so sorry If I am doing something weird, I follow this steps:

I download the opencv for ARM libraries, I build it with the cmake and I got the statics opencv ARM libraries without problems.

Then I try to compile my c++ file like this:

 arm-linux-g++ -static -o exampleWindows IPCamera.cpp `pkg-config --cflags --libs opencv`

And it works, so I got an executable, I write:

  file executable

And I get this output:

 ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux    2.6.26,    not stripped

So it seems that is ok, is an ARM format and is a static linked. But when I try to run this executable in my ARM is comming this error:

 OpenCV Error: Unspecified error (The function is not implemented. 
 Rebuild the library with Windows, GTK+ 2.x or Carbon support. 
 If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, 
 then re-run cmake or configure script) in cvNamedWindow, 
 file /home/jesus/opencv/opencv/modules/highgui/src/window.cpp, line 483
 terminate called after throwing an instance of 'cv::Exception'
 what():  /home/jesus/opencv/opencv/modules/highgui/src/window.cpp:483: error: (-2)    The      function is not implemented.
 Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or         Debian, install libgtk2.0-dev and pkg-config, 
  then re-run cmake or configure script in function cvNamedWindow

So I was looking for Internet and I find out that I needed to install the libgtk2.0-dev libraries and then re-install the opencv from the repository and run cmake with it again, making sure that the option WITH_GTK is marked, Once the Makefiles have been re-generated with CMAKE, run make, make install and ldconfig.

I did, but when I run my new executable in the ARM again come the same error. Then I realized that once I finish to execute the Cmake in the terminal output appear

  GTK+ 2.x:                    NO

So I think this is wrong, but I do not have idea why.

2014-06-19 09:11:07 -0600 commented question Opencv static link error

Sorry I did not explain propertly, once I do this: cmake -DBUILD_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../.. and when it is finished Ican see the /zlib, however /lib is still empty. Then I try to "make" and appear the same error as my question.

2014-06-19 07:44:50 -0600 commented question Opencv static link error

So somenthing like this: cmake -DBUILD_LIB=ON -DBUILD_ZLIB=ON -DBUILD_LIBJPEG=ON-..... DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..

2014-06-19 07:39:14 -0600 commented question Opencv static link error

thanks it seems that finish ok but when I do the make again it is comming the error. Shall I include the DBUILD option for each folder which are inside of the 3dparty folder?? even 3dparty/lib??

so something like this: cmake -DBUILD_LIB=ON -DBUILD_ZLIB=ON -DBUILD_LIBJASPER=ON -DBUILD_LIBJPEG=ON -DBUILD_LIBPNG=ON -DBUILD_LIBTIFF=ON -DBUILD_LIBWEBP=ON -DBUILD_OPENEXR=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..??

2014-06-19 07:26:59 -0600 commented question Opencv static link error

I see ok I think that I understand you. I did this: cmake -DBUILD_zlib=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../. and si comming this warning: CMake Warning: Manually-specified variables were not used by the project:

BUILD_zlib

Shall I change something in the arm-gnueabi.toolchain.cmake file?

2014-06-19 07:16:56 -0600 commented question Opencv static link error

actually the /3rdparty/lib is empty

2014-06-19 07:04:15 -0600 commented question Opencv static link error

Hi berak thak you for your answer. I check in the 3rdparty/lib/ and it does not exist the libzlib.a. Why happend that?? I only followed the tutorial. You mean in this command include the -DBUILD_zlib=ON in this one: cmake -DBUILD_zlib=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../. somenthing like that?

2014-06-19 06:15:38 -0600 asked a question Opencv static link error

Hi guys I am triying to install the opencv libraries for ARM and I following this tutorial:

 http://docs.opencv.org/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html

and everything is ok until I try to do the "make", when I execute the make is comming an error:

Linking C static library ../lib/libzlib.a
Error running link command: No such file or directory
make[2]: *** [3rdparty/lib/libzlib.a] Error 2
make[1]: *** [3rdparty/zlib/CMakeFiles/zlib.dir/all] Error 2
make: *** [all] Error 2

someone knows where can be the problem?? it is maybe in the opencv which I download?

Thank you so much

2014-06-18 11:15:24 -0600 asked a question ARM cross compilation error with Opencv

Hi guys, I have a nightmare with the cross-compilation of Opencv for ARM.

I am making an c++ application in Linux wich use Opencv Libraries. I followed this tutorial for get the opencv source:

http://docs.opencv.org/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html

I have already other tools-chain which I get from the supplier. When I finish the opencv install I have the opnecv folder with everything.

So I tried to compile my file like always:

 arm-linux-g++ -o camera Ipcamera.cpp

But I get this error:

IPCamera.cpp:12:30: error: opencv2/opencv.hpp: No such file or directory
IPCamera.cpp:13:29: error: opencv2/highgui.h: No such file or directory
IPCamera.cpp:14:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
IPCamera.cpp:18:22: error: X11/Xlib.h: No such file or directory
IPCamera.cpp:23: error: 'cv' is not a namespace-name
IPCamera.cpp:23: error: expected namespace-name before ';' token
IPCamera.cpp: In function 'int main(int, char**)':
IPCamera.cpp:53: error: 'cv' has not been declared
IPCamera.cpp:53: error: expected ';' before 'cap'
IPCamera.cpp:59: error: 'Display' was not declared in this scope
IPCamera.cpp:59: error: 'disp' was not declared in this scope
IPCamera.cpp:59: error: 'XOpenDisplay' was not declared in this scope
IPCamera.cpp:60: error: 'Screen' was not declared in this scope
IPCamera.cpp:60: error: 'scrn' was not declared in this scope
IPCamera.cpp:60: error: 'DefaultScreenOfDisplay' was not declared in this scope
IPCamera.cpp:70: error: 'cv' has not been declared
IPCamera.cpp:70: error: expected ';' before 'frame'
IPCamera.cpp:73: error: 'cv' has not been declared
IPCamera.cpp:73: error: 'CV_WINDOW_NORMAL' was not declared in this scope
IPCamera.cpp:75: error: 'cvMoveWindow' was not declared in this scope
IPCamera.cpp:80: error: 'CV_WND_PROP_FULLSCREEN' was not declared in this scope
IPCamera.cpp:80: error: 'CV_WINDOW_FULLSCREEN' was not declared in this scope
IPCamera.cpp:80: error: 'cvSetWindowProperty' was not declared in this scope
IPCamera.cpp:96: error: 'cap' was not declared in this scope
IPCamera.cpp:99: error: 'frame' was not declared in this scope
IPCamera.cpp:106: error: 'cv' has not been declared
IPCamera.cpp:109: error: 'cv' has not been declared

I have this includes in my .cpp file:

 #include <opencv2/opencv.hpp>     
 #include <opencv2/highgui.h>      
 #include <opencv2/imgproc/imgproc.hpp>

I was reading and the people says that I had to add the headers libraries path:

 arm-linux-g++ -o camera Ipcamera.cpp -I/home/jesus/opencv_build/build/opencv/include

this is the Path in which I have the opencv and opencv2 folders, but again I get other error:

    from IPCamera.cpp:12:
/home/jesus/opencv_build/build/opencv/include/opencv2/core/core.hpp:48:33: error: #include nested too deeply
In file included from IPCamera.cpp:12:
/home/jesus/opencv_build/build/opencv/include/opencv2/opencv.hpp:47:31: error: opencv2/imgproc.hpp: No such file or directory
/home/jesus/opencv_build/build/opencv/include/opencv2/opencv.hpp:48:29: error: opencv2/photo.hpp: No such ...
(more)
2014-06-11 09:15:06 -0600 commented question Opencv c++ linker problem ARM

shall I add those lines in the "arm-gnueabi.toolchain.cmake" file :

SET (CMAKE_C_COMPILER "/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi") SET (CMAKE_CXX_COMPILER "/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi")

for finish the cmake

2014-06-11 09:12:42 -0600 commented question Opencv c++ linker problem ARM

Could I work with /usr/include and usr/lib?

2014-06-11 09:11:45 -0600 commented question Opencv c++ linker problem ARM

Hi pthbrk thank you very much for your answer. I have installed the opencv, and I have the libopencv_*.so files here:/usr/lib and the opencv and opencv2 in usr/include I tried this: arm-linux-g++ -H -I/usr/include IPCamera.cpp but the output is hugh and with many errors. My problem is that when I tried to follow the tutorial after this: "git clone https://github.com/Itseez/opencv.git" Ishould make the build with this: "cmake -DSOFTFP=ON -DCMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv"

But I get this error:

The CXX compiler identification is unknown -- The C compiler identification is unknown so I cannot finish the cmake.

Any ideas, sorry for my unknowledge and thank you again

2014-06-11 06:34:41 -0600 commented question Opencv c++ linker problem ARM

Yes I have it, but how can I make the cross compilation with my toolchain??

2014-06-10 04:26:25 -0600 commented question Opencv c++ linker problem ARM

It seems that not reconozige the libraries

2014-06-10 04:25:50 -0600 commented question Opencv c++ linker problem ARM

IPCamera.cpp:16: error: 'cv' is not a namespace-name IPCamera.cpp:16: error: expected namespace-name before ';' token IPCamera.cpp: In function 'int main(int, char**)': IPCamera.cpp:46: error: 'cv' has not been declared IPCamera.cpp:46: error: expected ';' before 'cap' IPCamera.cpp:52: error: 'Display' was not declared in this scope IPCamera.cpp:52: error: 'disp' was not declared in this scope IPCamera.cpp:52: error: 'XOpenDisplay' was not declared in this scope IPCamera.cpp:53: error: 'Screen' was not declared in this scope IPCamera.cpp:53: error: 'scrn' was not declared in this scope IPCamera.cpp:53: error: 'DefaultScreenOfDisplay' was not declared in this scope IPCamera.cpp:63: error: 'cv' has not been declared IPCamera.cpp:63: error: expected ';' before 'frame'

2014-06-10 04:25:39 -0600 commented question Opencv c++ linker problem ARM

Hi pthbrk thank you for your answer. The thing is that I have already the toolchain installed /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0, so I was reading and I find out that I have to download the opencv sources from here "git clone https://github.com/Itseez/opencv.git" and then compile with my toolchain, but I do not know how, shall I change somenthing in the "arm-gnueabi.toolchain.cmake" file for indicate which toolchain compile?? the error message is something like this:

IPCamera.cpp:5:30: error: opencv2/opencv.hpp: No such file or directory IPCamera.cpp:6:39: error: opencv2/highgui/highgui.hpp: No such file or directory IPCamera.cpp:7:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory IPCamera.cpp:11:22: error: X11/Xlib.h: No such file or directory

2014-06-09 12:13:34 -0600 asked a question Opencv c++ linker problem ARM

Hi guys I am desperate I am trying to compile an .cpp file which use opencv but is imposible for me, Ired many things but I cannot get nothing clear. I do not have experience in this kind of compilation so I am pretty lost. I am working with an ARM, and my code is in c++. I was compiling other files without opencv libraries, and for do that I had to install the toolchain, I got it from the website and I installed it in this Path:

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0

after I added this directory to my global PATH like this:

export PATH=$PATH:/opt/freescale/usr/local/gcc-4.4.4-glibc- 2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin export ARCH=arm

after this I set up my enviroment:

export PATH=$PATH:/opt/freescale/usr/local/gcc-4.4.4-glibc- 2.11.1-multilib-1.0 export ARCH=arm export CROSS_COMPILE=arm-linux-

Until here everything is perfect, so I can compile with this command:

arm-linux-g++ IPCamera.cpp -o tru2

and It works perfect, the IPCamera.cpp does not use opencv in this ocasion.

My problem comming now. I followed this tutorial http://www.ridgesolutions.ie/index.php/2013/05/24/building-cross-compiling-opencv-for-linux-arm/ and I finish it propertly. But now I do not have idea how to compile my file, I mean, shall I change the PATH??shall I add the link the libraries or the path libraries, somenthing like this:

arm-linux-g++ -I/path/to/opencv/include -L/path/to/library IPCamera.cpp -o tru2 -lopencv_core -pthread

If it is, How should I do it??. Sorry but I do not have too much idea about that, so someone can help me step by step. Thank you very much