4 Replies Latest reply on Aug 18, 2018 3:46 PM by MartyG

    libopencv-dev broke with RealSense Samples Install

    edcepp

      I broke libopencv-dev during my install of RealSense Samples for the D200. I wanted to install realsense_ros_camera. My goal was to use it with OpenCL Caffe, which at the time was working with my laptop's built in web cam. It appears that I should not have attempted this and should have moved on to newer RealSense camera instead. I attempted to roll back by uninstalling RealSense Samples but have been unable to recover libopencv-dev. Furthermore, I cannot install RZ300 drivers until libopencv-dev is fixed. 

       

      Apologies: I'm afraid that my knowledge of Ubuntu allows me to get into trouble but not always out of it. Details follow.

       

      • Ubuntu: 16.04
      • ROS: Kinetic
      • D200 (I will upgrade to a RZ300 after I fix libopencv-dev)
      • Recent Dell Laptop

       

      I believe I broke OpenCL Caffe and other applications when I did this during RealSense Samples install.

      sudo apt install -y librealsense-object-recognition-dev librealsense-persontracking-dev librealsense-slam-dev libopencv-dev

       

      This is what I discovered about my install.

       

      $ aptitude search librealsense-object-recognition-dev

           u   librealsense-object-recognition     - Intel(R) RealSense(tm) Object Recognition

       

      $ aptitude search librealsense-persontracking-dev

           u   librealsense-persontracking-dev     - Development files for Intel RealSense Pers

       

      $ aptitude search librealsense-slam-dev

           u   librealsense-slam-dev               - Development files for Intel RealSense SLAM

       

      $ aptitude search libopencv-dev

           BB  libopencv-dev                       - development files for opencv             

           p   libopencv-dev:i386                  - development files for opencv

       

      I attempted to back out by removing all the packages I installed above with:

      sudo apt-get remove <package-name>

       

      Then I reinstalled libopencv-dev. It failed when it tried to unpack libopencv3.1-java.

       

      sudo apt-get install libopencv-dev

      ...

      Unpacking libopencv3.1-java (3.1.0+dfsg-1~realsense4.18) ...

      dpkg: error processing archive /var/cache/apt/archives/libopencv3.1-java_3.1.0+dfsg-1~realsense4.18_all.deb (--unpack):

      trying to overwrite '/usr/share/java/opencv.jar', which is also in package libopencv2.4-java 2.4.9.1+dfsg-1.5ubuntu1

      ...

       

      In retrospect it appears to be trying to install libopencv-dev 3.1 over 2.4.9 and couldn't. I don't fully understand what the problem is and did a lot of unwise things while I was trying to figure it out. I am no longer sure what my opencv status is. I understand that ROS has problems with version 3. On my other Ubuntu box it has ros-kinetic-opencv3, libopencv-dev, and libopencv2.4-java installed. I think I want to get back to that state and don't know how.

       

      This is my current status when I attempt to install libopencv-dev.

       

      -- BEFORE libopencv-dev INSTALL

      $ aptitude search libopencv2.4-java

      p   libopencv2.4-java               - Java bindings for the computer vision libr

       

      ~$ aptitude search libopencv3.1-java

      p   libopencv3.1-java               - Java bindings for the computer vision libr

       

      ~$ aptitude search libopencv-dev

      p   libopencv-dev                   - development files for opencv             

      p   libopencv-dev:i386              - development files for opencv             

       

      -- DURING libopencv-dev INSTALL

      ~$ sudo apt-get install libopencv-dev

      [sudo] password for xxxx:

      Reading package lists... Done

      Building dependency tree      

      Reading state information... Done

      The following packages were automatically installed and are no longer required:

        linux-headers-4.15.0-24 linux-headers-4.15.0-24-generic

        linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic

        linux-headers-4.4.0-130 linux-headers-4.4.0-130-generic

        linux-image-4.15.0-24-generic linux-image-4.15.0-29-generic

        linux-modules-4.15.0-24-generic linux-modules-4.15.0-29-generic

      Use 'sudo apt autoremove' to remove them.

      The following additional packages will be installed:

        libopencv3.1-java

      The following NEW packages will be installed:

        libopencv-dev libopencv3.1-java

      0 upgraded, 2 newly installed, 0 to remove and 37 not upgraded.

      Need to get 0 B/487 kB of archives.

      After this operation, 849 kB of additional disk space will be used.

      Do you want to continue? [Y/n] Y

      Selecting previously unselected package libopencv3.1-java.

      (Reading database ... 512825 files and directories currently installed.)

      Preparing to unpack .../libopencv3.1-java_3.1.0+dfsg-1~realsense4.18_all.deb ...

      Unpacking libopencv3.1-java (3.1.0+dfsg-1~realsense4.18) ...

      Selecting previously unselected package libopencv-dev.

      Preparing to unpack .../libopencv-dev_3.1.0+dfsg-1~realsense4.18_amd64.deb ...

      Unpacking libopencv-dev (3.1.0+dfsg-1~realsense4.18) ...

      Processing triggers for man-db (2.7.5-1) ...

      Setting up libopencv3.1-java (3.1.0+dfsg-1~realsense4.18) ...

      Setting up libopencv-dev (3.1.0+dfsg-1~realsense4.18) ...

       

      -- AFTER libopencv-dev INSTALL

      $ aptitude search libopencv-dev

      iB  libopencv-dev                   - development files for opencv             

      p   libopencv-dev:i386              - development files for opencv

                  

      $ aptitude search libopencv3.1-java

      iBA libopencv3.1-java               - Java bindings for the computer vision libr

       

      $ aptitude search libopencv2.4-java

      p   libopencv2.4-java               - Java bindings for the computer vision libr

       

      $ aptitude search opencv | grep ^i

      ...

      i A ros-kinetic-opencv3             - OpenCV 3.x

       

      $ find /opt/ros/kinetic/ -name cv2.so

      /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so

       

      As I stated above, I believe I want to get back to version 2.4.9. So that a package search will include the following. I am confused by the mixture of versions 2.4 and 3.x in my package searches but this is how it looks on my working Ubuntu system.

       

      -- TARGET OF WHAT I THINK I WANT

      $ aptitude search opencv | grep ^i

      i   libopencv-dev                   - development files for opencv

      i A libopencv2.4-java               - Java bindings for the computer vision libr

      i A ros-kinetic-opencv3             - openCV 3.x

      ...

       

      $ find /opt/ros/kinetic/ -name cv2.so

      /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so

       

      I am appreciative of any clues about how to further analyze my problem and recover. I suspect you will need additional information.

       

      My goal is to leverage the IntelROSProject (http://wiki.ros.org/IntelROSProject).

        • 1. Re: libopencv-dev broke with RealSense Samples Install
          MartyG

          Do you mean you have an F200 camera, please?  the D naming convention was only started with the current generation of RealSense cameras.

           

          A process that has worked for some people when failing to reinstall OpenCV after an uninstall is:

           

          1. Uninstall OpenCV 3.3.1

           

          2. try

          $ sudo apt-get -f install

           

          3. Use this instruction:

          $ apt-get purge libhighgui-dev

          • 2. Re: libopencv-dev broke with RealSense Samples Install
            edcepp

            Thanks! I'll try this.

             

            The camera is actually a R200. It is part of a TurtleBot3 kit. See TurtleBot3 . Apologies.

            • 3. Re: libopencv-dev broke with RealSense Samples Install
              edcepp

              This didn't fix the problem and broke viewing from my built-in usb cam. This is what I did.

               

              2005  sudo apt-get remove ros-kinetic-opencv3

              2006  aptitude search opencv | grep ^i

              2007  sudo apt-get -f install

              2008  aptitude search libhighgui-dev

              2010  sudo apt-get purge libhighgui-dev

              2011  sudo apt-get install ros-kinetic-opencv3

              2014  sudo apt-get install libopencv-dev

               

              This is the status. I don't know what the "B" means in the context of "iB".

               

              ~$ aptitude search ros-kinetic-opencv3

              i   ros-kinetic-opencv3             - OpenCV 3.x                               

              p   ros-kinetic-opencv3:i386        - OpenCV 3.x

               

              ~$ aptitude search libopencv-dev

              iB  libopencv-dev                   - development files for opencv             

              p   libopencv-dev:i386              - development files for opencv             

                               

              ~$ aptitude search libopencv3.1-java

              iBA libopencv3.1-java               - Java bindings for the computer vision libr

               

              ~$ aptitude search libopencv2.4-java

              p   libopencv2.4-java               - Java bindings for the computer vision libr

               

              Notice that libopencv-dev and libopencv3.1-java did not get installed correctly. I was hoping it would install libopencv2.4-java instead because that is what my other Ubuntu system has installed on it.

               

              Do you need more detail?

              • 4. Re: libopencv-dev broke with RealSense Samples Install
                MartyG

                Thanks for the extra information.   I'm very sorry that your situation has not improved. 

                 

                I am not an expert on the workings of Ubuntu, unfortunately as my main experience is with Windows.  If your Ubuntu installation has got in as much of a tangle as you say then it may be easier just to wipe and reinstall Ubuntu, and then OpenCV and Librealsense, from the beginning.

                 

                Alternatively, you could post a help request over on the RealSense GitHub, where the RealSense developers and engineers reside.  To open a new case, click on the 'New issue' button the link below.  Good luck!

                 

                Issues · IntelRealSense/librealsense · GitHub