Ask Your Question

polar's profile - activity

2019-08-22 02:54:35 -0500 received badge  Famous Question (source)
2019-08-22 02:54:35 -0500 received badge  Notable Question (source)
2019-08-22 02:54:35 -0500 received badge  Popular Question (source)
2019-05-20 02:26:27 -0500 marked best answer Linking opencv with ROS using cmake issue

Am getting this compilation error

../devel/lib/libXY.so: undefined reference to `cv::calcOpticalFlowPyrLK

In my CMake

find_package(OpenCV REQUIRED core imgproc highgui videoio  PATHS /home/polar/soft/lib/opencv/opencv-3.1.0/cmake)

... then

target_link_libraries(${file2link}
    ${catkin_LIBRARIES}
    ${MY_LIB}
    ${MY_LIB}
    ${gsl_LIBRARIES}
    # ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY}
    ${Boost_LIBRARIES}
    ${OpenCV_LIB} 
    ${OpenCV_LIBRARIES}
    ${OpenCV_LIBS} 
   )

For info, I installled opencv 3.1.0 myself. In XY.h I just call opencv like

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <opencv2/features2d.hpp>
#include "opencv2/xfeatures2d.hpp"

Any idea on the source of the problem?

2018-01-19 14:36:31 -0500 received badge  Notable Question (source)
2017-11-28 12:57:41 -0500 marked best answer How to link opencv to ROS indigo (catkin) with CMake (ubuntu 14.04)?

Am so far not able to use cv_bridge. Am getting this compilation error

Make Error at /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake:106 (message):
  Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
  which is not found.  It does neither exist as an absolute directory nor in
  '/opt/ros/indigo//usr/include/opencv'.  Ask the maintainer ..

May be the problem in my CMake (...?)

cmake_minimum_required(VERSION 2.8.3)
project(XY)

find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
std_msgs
)

#set(OpenCV_DIR "/usr/local/lib/opencv")
find_package(OpenCV REQUIRED core imgproc highgui PATHS /home/polar/soft/lib/opencv/opencv-3.1.0/cmake)
include_directories( ${OpenCV_INCLUDE_DIRS} )

if(OpenCV_FOUND)
# include_directories(${Boost_INCLUDE_DIRS})
message("\n\n OpenCV found!!!! \n\n")   
endif()

Any idea on the cause of the problem and how to solve it please? I was using ROS fuerte in the past and never experienced such problems....

2017-11-02 02:22:52 -0500 received badge  Popular Question (source)
2017-06-09 15:08:02 -0500 received badge  Student (source)
2017-01-30 03:23:13 -0500 received badge  Popular Question (source)
2016-12-18 05:52:48 -0500 received badge  Famous Question (source)
2016-12-18 05:52:48 -0500 received badge  Notable Question (source)
2016-12-17 00:32:15 -0500 received badge  Famous Question (source)
2016-11-20 19:40:23 -0500 received badge  Famous Question (source)
2016-10-12 16:48:55 -0500 received badge  Notable Question (source)
2016-10-12 16:47:19 -0500 received badge  Famous Question (source)
2016-09-29 15:37:52 -0500 received badge  Notable Question (source)
2016-08-08 05:44:07 -0500 commented question How to force my ros package not using some ROS-provided libs?

No error, just that the compiler still uses the version provided by ROS rather than the standalone version I installed from source.

2016-08-05 05:41:42 -0500 received badge  Popular Question (source)
2016-08-04 21:59:06 -0500 asked a question How to force my ros package not using some ROS-provided libs?

Let say I created ros package my_package that depends on library (or package)ext_package version 1. I already installed ext_package as stand-alone on my machine and everything worked fine so far...

Now, I created another new_package but needs to use ext_package provided by ros to read data from topic; need to use bridge. However ROS only provides ext_package V2, which is not compatible with V1. Am getting compilation issues.

So I would have to rewrite completely my_package to accomodate V2.... which would be amazingly tedious.

Thus the question: how to edit CMake file such that my_package uses standalone ext_package locate at ~/PathToLib/ext_package/build?

I already tried something like,

unset(EXT_PACKAGE_CONFIG_PATH CACHE)
 unset(EXT_PACKAGE_DIR CACHE)

 message(STATUS  "...initial CMAKE_PREFIX_PATH:")
 message(STATUS ${CMAKE_PREFIX_PATH})

 set(TMP_PREFIX_PATH ${CMAKE_PREFIX_PATH})
 set(CMAKE_PREFIX_PATH "/home/${usrname}/soft/lib/ext_package/build/installed")

 message(STATUS  "... corrected CMAKE_PREFIX_PATH")
 message(STATUS ${CMAKE_PREFIX_PATH})

  SET (EXT_PACKAGE_ROOT "/home/${usrname}/soft/lib/ext_package/build/installed")
  SET (EXT_PACKAGE_INCLUDE_DIRS "/home/${usrname}/soft/lib/ext_package/build/installed/include")
  SET (EXT_PACKAGE_LIBRARY_DIR "/home/${usrname}/soft/lib/ext_package/build/installed/lib")
find_package(ext_package REQUIRED)

... but without success. Any idea please?

P.S. In my case exta_package is ViSP. I installed version 2.10 as standalone on my machine. Also, am using ROS Kinetic.

2016-08-04 04:13:13 -0500 asked a question Converting ros images to Visp images (vpImage)?

Any idea how to grab the images from a topic using ros kinetic and convert them, say, to vpImage <unsigned char>? I already installed ros-kinetic-visp, but am not finding the doc on how to use it. In addition, I encountered some Internet pages mentioning that visp_bridge as being deprecated...

2016-07-29 06:02:44 -0500 received badge  Famous Question (source)
2016-07-25 04:41:13 -0500 received badge  Famous Question (source)
2016-07-21 14:32:51 -0500 received badge  Notable Question (source)
2016-07-20 21:18:52 -0500 commented answer Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`

@gvdhoorn Thanks for the info. But still, NONE of these report the issue related to image_transport (segmentation fault).

2016-07-19 23:10:59 -0500 asked a question How to know/set the frequency at which the images are taken (grabbed)?

I found that the frequency I compute from the time between two successive callbacks and that from using rostopic hz different...

With rostopic hz /pg_15508342/image_raw I get:

verage rate: 149.314 min: 0.004s max: 0.009s std dev: 0.00051s window: 297

However, from this very short code, that computes the frequency at which the callback of the same topic is called,

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

#include <time.h>
#include <boost/timer.hpp>
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#include <boost/version.hpp>
#include  "boost/bind.hpp"
#include  "boost/bind.hpp"
#include <iostream>

using namespace std;

boost::posix_time::ptime time1; 
boost::posix_time::time_duration timeloop;
double timeloop_sc;

int image_itr(0);

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
     //---
      if(image_itr == 0)
        time1 = boost::posix_time::microsec_clock::local_time();

      timeloop =  boost::posix_time::microsec_clock::local_time() - time1;
  time1 = boost::posix_time::microsec_clock::local_time();
  timeloop_sc = 1e-3* (double)timeloop.total_milliseconds();
  cout << "itr " << image_itr++ << "   fps: " << 1.0/timeloop_sc << endl;
 //----
  try
  {
    cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);
    cv::waitKey(30);
  }
  catch (cv_bridge::Exception& e)
  {
    ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
  }
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "image_listener");
  ros::NodeHandle nh;

  cv::namedWindow("view");
  cv::startWindowThread();
  image_transport::ImageTransport it(nh);
  image_transport::Subscriber sub = it.subscribe("/pg_15508342/image_raw", 1, imageCallback);
  ros::spin();
  cv::destroyWindow("view");
}

I get around 30 fps. Moreover, if I run this same code from another host machine (through ssh), I get even a different value (varying but almost around 1 fps).

Why this difference of values? I should have missed/misunderstood something about ros image topic (?)

2016-07-19 22:20:55 -0500 received badge  Popular Question (source)
2016-07-19 20:40:46 -0500 commented answer Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`

I would be grateful if you can provide me the link. I found only quite few answers related to segmentation fault with image_transport....

2016-07-19 04:20:23 -0500 commented answer Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`

@gvdhoorn please what has already been answered: the ability to use a standalone boost with ros or the fact that the segmentation fault is due to the standalone boost?

2016-07-19 01:01:31 -0500 received badge  Popular Question (source)
2016-07-18 22:55:25 -0500 answered a question Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`

I think I can see now the origin of the problem. It is related to Boost included from outside ros. In fact I should have reported my full CMakeLists.txt in the question, but I was initially far from thinking the issue was in any how related...

In my CMakeLists.txt I included my own boost (latest version downloaded from source) like

SET (BOOST_DIR "/home/polar/soft/lib/boost/boost_1_61_0")
SET (BOOST_INCLUDEDIR "/home/polar/soft/lib/boost/boost_1_61_0/build/include")
SET (BOOST_LIBRARYDIR "/home/polar/soft/lib/boost/boost_1_61_0/build/lib")

FIND_PACKAGE(Boost 1.61.0 REQUIRED thread)
if (NOT Boost_FOUND)
  message(FATAL_ERROR " Fatal error: Boost (version >= 1.55) required.")
else()
  message(STATUS "Setting up BOOST")
  message(STATUS " Includes - ${Boost_INCLUDE_DIRS}")
  message(STATUS " Library  - ${Boost_LIBRARY_DIRS}")
  include_directories(${Boost_INCLUDE_DIRS})
  link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)

As such I got segmentation fault at image_transport::ImageTransport it(nh);. However, after replacing the above CMake code with only

FIND_PACKAGE(Boost)

I no longer have that segmentation fault.

Thus another question, how to use the standalone Boost with ROS catkin??

2016-07-17 22:43:26 -0500 asked a question Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`

I included well image_transport in both my CMake file and packake.xml as follows:

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  rospy
  std_msgs
  message_generation
  genmsg
  )

generate_messages(
  DEPENDENCIES
  std_msgs
  )

catkin_package(
  CATKIN_DEPENDS  cv_bridge image_transport roscpp rospy std_msgs message_generation
  )

....

and

<buildtool_depend>catkin</buildtool_depend>
 <build_depend>cv_bridge</build_depend>
  <build_depend>image_transport</build_depend>
  <build_depend>roscpp</build_depend>
 <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>message_generation</build_depend>
   <run_depend>cv_bridge</run_depend>
  <run_depend>image_transport</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
 <run_depend>std_msgs</run_depend>
  <run_depend>message_runtime</run_depend>
 <run_depend>message_generation</run_depend>
    <run_depend>image_transport</run_depend>

and in my .cpp file

#include <ros/ros.h>
#include <image_transport/image_transport.h>
.....
int main(int argc, char **argv)
{

  ros::init(argc, argv, "imagegraber");
  ros::NodeHandle nodea;

 image_transport::ImageTransport it(nodea);

image_transport::Subscriber sub = it.subscribe("/pg_15508342/image_raw", 1, imageCallback);


 ros::spin();
return 0;
}

Yet, I receive Segmentation fault (core dumped) when I run my code.... What could be the problem? The code crashes at image_transport::ImageTransport it(nodea);

Am also able to run image_transport with command line: rosrun image_transport republish..... Able also to use image_view, etc...

2016-07-11 23:25:32 -0500 asked a question Image frames not displayed correctly with image_view

The camera am using is a Point Grey Chameleon 3 model CM3-U3-13Y3M-CS. Am running it via ros indigo with these commands $ roslaunch flea3 single_node.launch device:=15508342

$ rosrun image_view image_view image:=/pg_15508342/image_raw

However, quite often I get a strange images; pixels displayed in the wrong location. Like the format was incorrect. What could be the cause of this and how to solve it?

2016-07-11 23:15:57 -0500 received badge  Scholar (source)
2016-07-11 23:15:52 -0500 received badge  Supporter (source)
2016-07-11 06:48:04 -0500 asked a question Setting PointGrey camera parameters?

Am bit confuse on where and how to modify Cameleon 3 camera parameters. For example, in PointGrey,cfg, there seems to be three different values... Why not only one

gen.add("frame_rate",         double_t, SensorLevels.RECONFIGURE_RUNNING,    "Camera speed (frames per second).",                                            100, 0, 100)

Also please, how to set the values in camera.launch instead of PointGrey,cfg, so as to avoid the need of compiling after each modification?

Am particularly interested in frame_rate, exposure, shutter speed, and image size...

2016-06-21 16:30:08 -0500 received badge  Notable Question (source)
2016-06-05 21:30:57 -0500 received badge  Notable Question (source)