13 Replies Latest reply on Mar 15, 2015 9:00 AM by annu_shah

    intel galileo gen 2 opencv problem with namedWindow imshow waitKey

    annu_shah

      hi i get this error when i run my code :-

       

       

       

      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 /emb_dev/yocto/meta-clanton_v1.0.4-1dt/yocto_build/tmp/work/i586-poky-linux-uclibc/opencv/2.4.9-r1/opencv-2.4.9/modules/highgui/src/window.cpp, line 483

      terminate called after throwing an instance of 'cv::Exception'

        what():  /emb_dev/yocto/meta-clanton_v1.0.4-1dt/yocto_build/tmp/work/i586-poky-linux-uclibc/opencv/2.4.9-r1/opencv-2.4.9/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

       

       

      Aborted

       

       

       

       

      This is my code and when i remove namedWindow imshow waitKey functions the error is gone.

       

       

       

       

      #include <opencv2/opencv.hpp>

      #include <iostream>

       

      using namespace cv;

      using namespace std;

       

       

      int main( int argc, const char** argv )

      {

      Mat img = imread("pic.jpg", CV_LOAD_IMAGE_UNCHANGED); //read the image data in t

       

       

       

       

      if(img.empty())

                 {

             cout<<"Not getting any frames"<<endl;

                 }

       

       

                 else if(!img.empty())

                 {

             cout<<"Getting Continuous Frames"<<endl;

       

       

       

       

             namedWindow("Captured Frame",CV_WINDOW_AUTOSIZE);

                  c("Captured Frame",img);

                   waitKey(0);

       

       

                 }

       

       

       

       

       

       

       

       

       

       

      return 0;

      }

        • 1. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
          Intel_Peter

          Hello annu_shah,

           

          It looks like you might be missing the GTK+ library or not including it. If  you haven't install it, I suggest you to visit http://www.gtk.org/.

           

          You can also see this thread, it has some questions about a related issue:

           

          Re: OpenCV and CVBlob compilation problem

           

          Peter.

          • 2. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
            annu_shah

            is there a command to install the gtk+

             

            i used this command but its not working

             

            opkg install gtk+-dev

            • 3. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
              Intel_Peter

              Hello annu_shah,

               

              You can install this package by downloading it directly (from here: http://www.gtk.org/download/linux.php) and then follow the instructions in https://developer.gnome.org/gtk3/stable/gtk-building.html

               

              Peter.

              • 4. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                annu_shah

                while extracting the file i am getting this message

                 

                Cannot open: No space left on device

                 

                i am using a 16GB micro sd card

                • 5. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                  annu_shah

                  i have to follow a deadline kindly help me

                  • 6. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                    Intel_Peter

                    Hello annu_shah,

                     

                    I found this other thread: tar: gtk+-3.14.0/configure: Cannot write: No space left on device error which I believe is a continuation of this one, but you post it on the Edison section. Are you using a Galileo or an Edison? I ask because the solution depending on what you're working on could be very different. If you are using a Galileo, first make sure you're using the Galileo's Yocto complete image which you can find here: Downloads and Documentation: Getting the Most out of your Board. If you're using the Yocto image and still have issue with this, why don't you try to decompress the file on your PC, then paste it on the SD-Card, and once you have it there, install it.

                     

                    Peter.

                    • 7. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                      annu_shah

                      i am using intel galileo gen 2 ,i am using yocto image 1.4.2 ,i have copied  the extracted folder " gtk+-3.14.0"it on the sd card.

                       

                      Next according to this link

                      https://developer.gnome.org/gtk3/stable/gtk-building.html

                       

                      i have to run this command

                      ../configure --prefix=/opt/gtk

                      and i am getting error

                       

                       

                       

                       

                       

                      12.png

                       

                      also i have no idea how to see the copied fle through linux.

                       

                      Regards

                      Annu shah

                      • 8. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                        annu_shah

                        after coping the extracted folder,i have to  follow the next instruction

                        i need to find the copied folder in the terminal that i am unable to do

                        • 9. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                          annu_shah

                          i have been able to locate the copied folder its in

                           

                          media/mmcblk0p1

                           

                          then i edit the configure file and add the following lines :-

                           

                          CPPFLAGS="-I/opt/gtk/include"

                            LDFLAGS="-L/opt/gtk/lib"

                            PKG_CONFIG_PATH="/opt/gtk/lib/pkgconfig"

                            export CPPFLAGS LDFLAGS PKG_CONFIG_PATH

                           

                          CPPFLAGS="-I/opt/gtk/include"

                            LDFLAGS="-L/opt/gtk/lib"

                            PKG_CONFIG_PATH="/opt/gtk/lib/pkgconfig"

                            export CPPFLAGS LDFLAGS PKG_CONFIG_PATH

                           

                           

                          next when i run the ./configure --prefix=/opt/gtk

                           

                           

                          alot of things are found but i get this error:-

                           

                           

                          checking build system type... i586-pc-linux-uclibc

                          checking host system type... i586-pc-linux-uclibc

                          checking for a BSD-compatible install... build-aux/install-sh -c

                          checking whether build environment is sane... yes

                          checking for a thread-safe mkdir -p... build-aux/install-sh -c -d

                          checking for gawk... no

                          checking for mawk... no

                          checking for nawk... no

                          checking for awk... awk

                          checking whether make sets $(MAKE)... yes

                          checking whether make supports nested variables... yes

                          checking whether UID '0' is supported by ustar format... yes

                          checking whether GID '0' is supported by ustar format... yes

                          checking how to create a ustar tar archive... gnutar

                          checking whether to enable maintainer-specific portions of Makefiles... yes

                          checking whether make supports nested variables... (cached) yes

                          checking for gcc... gcc

                          checking whether the C compiler works... yes

                          checking for C compiler default output file name... a.out

                          checking for suffix of executables...

                          checking whether we are cross compiling... no

                          checking for suffix of object files... o

                          checking whether we are using the GNU C compiler... yes

                          checking whether gcc accepts -g... yes

                          checking for gcc option to accept ISO C89... none needed

                          checking whether gcc understands -c and -o together... yes

                          checking for style of include used by make... GNU

                          checking dependency style of gcc... gcc3

                          checking how to run the C preprocessor... gcc -E

                          checking for gcc... gcc

                          checking whether we are using the GNU C compiler... (cached) yes

                          checking whether gcc accepts -g... yes

                          checking for gcc option to accept ISO C89... (cached) none needed

                          checking whether gcc understands -c and -o together... (cached) yes

                          checking dependency style of gcc... (cached) gcc3

                          checking how to run the C preprocessor... gcc -E

                          checking whether gcc and cc understand -c and -o together... yes

                          checking whether make sets $(MAKE)... (cached) yes

                          checking for native Win32... no

                          checking for grep that handles long lines and -e... /bin/grep

                          checking for egrep... /bin/grep -E

                          checking for ANSI C header files... yes

                          checking for sys/types.h... yes

                          checking for sys/stat.h... yes

                          checking for stdlib.h... yes

                          checking for string.h... yes

                          checking for memory.h... yes

                          checking for strings.h... yes

                          checking for inttypes.h... yes

                          checking for stdint.h... yes

                          checking for unistd.h... yes

                          checking minix/config.h usability... no

                          checking minix/config.h presence... no

                          checking for minix/config.h... no

                          checking whether it is safe to define __EXTENSIONS__... yes

                          checking for c++... c++

                          checking whether we are using the GNU C++ compiler... yes

                          checking whether c++ accepts -g... yes

                          checking dependency style of c++... gcc3

                          checking how to print strings... printf

                          checking for a sed that does not truncate output... /bin/sed

                          checking for fgrep... /bin/grep -F

                          checking for ld used by gcc... /usr/i586-poky-linux-uclibc/bin/ld

                          checking if the linker (/usr/i586-poky-linux-uclibc/bin/ld) is GNU ld... yes

                          checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B

                          checking the name lister (/usr/bin/nm -B) interface... BSD nm

                          checking whether ln -s works... no, using cp -pR

                          checking the maximum length of command line arguments... 32768

                          checking whether the shell understands some XSI constructs... yes

                          checking whether the shell understands "+="... yes

                          checking how to convert i586-pc-linux-uclibc file names to i586-pc-linux-uclibc format... func_convert_file_noop

                          checking how to convert i586-pc-linux-uclibc file names to toolchain format... func_convert_file_noop

                          checking for /usr/i586-poky-linux-uclibc/bin/ld option to reload object files... -r

                          checking for objdump... objdump

                          checking how to recognize dependent libraries... pass_all

                          checking for dlltool... no

                          checking how to associate runtime and link libraries... printf %s\n

                          checking for ar... ar

                          checking for archiver @FILE support... @

                          checking for strip... strip

                          checking for ranlib... ranlib

                          checking command to parse /usr/bin/nm -B output from gcc object... ok

                          checking for sysroot... no

                          checking for mt... no

                          checking if : is a manifest tool... no

                          checking for dlfcn.h... yes

                          checking for objdir... .libs

                          checking if gcc supports -fno-rtti -fno-exceptions... no

                          checking for gcc option to produce PIC... -fPIC -DPIC

                          checking if gcc PIC flag -fPIC -DPIC works... yes

                          checking if gcc static flag -static works... no

                          checking if gcc supports -c -o file.o... yes

                          checking if gcc supports -c -o file.o... (cached) yes

                          checking whether the gcc linker (/usr/i586-poky-linux-uclibc/bin/ld) supports shared libraries... yes

                          checking whether -lc should be explicitly linked in... no

                          checking dynamic linker characteristics... GNU/Linux ld.so

                          checking how to hardcode library paths into programs... immediate

                          checking whether stripping libraries is possible... yes

                          checking if libtool supports shared libraries... yes

                          checking whether to build shared libraries... yes

                          checking whether to build static libraries... no

                          checking how to run the C++ preprocessor... c++ -E

                          checking for ld used by c++... /usr/i586-poky-linux-uclibc/bin/ld

                          checking if the linker (/usr/i586-poky-linux-uclibc/bin/ld) is GNU ld... yes

                          checking whether the c++ linker (/usr/i586-poky-linux-uclibc/bin/ld) supports shared libraries... yes

                          checking for c++ option to produce PIC... -fPIC -DPIC

                          checking if c++ PIC flag -fPIC -DPIC works... yes

                          checking if c++ static flag -static works... no

                          checking if c++ supports -c -o file.o... yes

                          checking if c++ supports -c -o file.o... (cached) yes

                          checking whether the c++ linker (/usr/i586-poky-linux-uclibc/bin/ld) supports shared libraries... yes

                          checking dynamic linker characteristics... (cached) GNU/Linux ld.so

                          checking how to hardcode library paths into programs... immediate

                          configure: creating ./config.lt

                          config.lt: creating libtool

                          checking for special C compiler options needed for large files... no

                          checking for _FILE_OFFSET_BITS value needed for large files... 64

                          checking dependency style of gcc... gcc3

                          checking for nm... /usr/bin/nm -B

                          checking for some Win32 platform... no

                          checking for shm_open in -lrt... yes

                          checking for posix_fallocate... yes

                          checking for pkg-config... /usr/bin/pkg-config

                          checking pkg-config is at least version 0.9.0... yes

                          checking for wayland-scanner... no

                          checking for WAYLAND_DEPENDENCIES... no

                          checking whether build environment is sane... yes

                          checking for BASE_DEPENDENCIES... no

                          configure: error: Package requirements (glib-2.0 >= 2.41.2    atk >= 2.12.0    pango >= 1.36.7    cairo >= 1.12.0    cairo-gobject >= 1.12.0    gdk-pixbuf-2.0 >= 2.30.0) were not met:

                           

                           

                          Requested 'glib-2.0 >= 2.41.2' but version of GLib is 2.34.3

                          No package 'atk' found

                          No package 'pango' found

                          No package 'cairo' found

                          No package 'cairo-gobject' found

                          No package 'gdk-pixbuf-2.0' found

                           

                           

                          Consider adjusting the PKG_CONFIG_PATH environment variable if you

                          installed software in a non-standard prefix

                          • 10. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                            Intel_Peter

                            Hello annu_shah,

                             

                            I believe you are missing those dependencies, so you might have to install them in order to make the GTK library work.

                             

                            Peter.

                            • 11. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                              annu_shah

                              Intel Galileo Gen 2 Eurobot videos :-

                              annu shah - Videos - Google+

                               

                              i am using now the iot image and it already has the gtk library installed while running my code i get this error:-

                              28.png

                              • 12. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                                Intel_Peter

                                Is this the code you're trying to run this:

                                 

                                #include <opencv2/opencv.hpp>
                                #include <iostream>
                                
                                using namespace cv;
                                using namespace std;
                                
                                int main( int argc, const char** argv )
                                {
                                        Mat img = imread("pic.jpg", CV_LOAD_IMAGE_UNCHANGED); //read the image data in t
                                        if(img.empty())
                                        {
                                                cout<<"Not getting any frames"<<endl;
                                        }
                                        else if(!img.empty())
                                        {
                                                cout<<"Getting Continuous Frames"<<endl;
                                                namedWindow("Captured Frame",CV_WINDOW_AUTOSIZE);
                                                c("Captured Frame",img);
                                                waitKey(0);
                                        }
                                return 0;
                                }
                                

                                 

                                Or is it something different? (This one is what you posted above) Because I get a completely different error.

                                 

                                Peter.

                                • 13. Re: intel galileo gen 2 opencv problem with namedWindow imshow waitKey
                                  annu_shah

                                  instead of c("Captured Frame",img); i use imwrite() function to the image and save it which works but the issue is with nameWindow() imshow() and waitkey() functions imshow() is used to show the image this is my code.

                                   

                                  the error is :-

                                   

                                   

                                  (Captured Frame:247): Gtk-WARNING **: cannot open display:

                                   

                                  ////////////////////////////////////////////////////////////////////////////////////////////////

                                   

                                  #include <opencv2/opencv.hpp>

                                  #include <math.h>

                                  using namespace cv;

                                  //void sobelFilter(Mat , Mat , int , int );

                                  int main(int argc, char *argv[])

                                  {

                                   

                                   

                                  VideoCapture cap(0); //intialize camera

                                   

                                   

                                  for(;;)

                                  {

                                   

                                   

                                  Mat image;

                                  cap.read(image);

                                  //cap.release(); //turn the camera off

                                  namedWindow( "webcam image", CV_WINDOW_AUTOSIZE );

                                  imshow("webcam image", image);

                                  imwrite("webcam_image.jpg", image);

                                  if(waitKey(30) >= 0) break;

                                   

                                   

                                  }

                                  return 0;

                                  }