ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't know if you need videoio later but for now you don't, so comment it till you solve segmentation fault (core dumped) problem.

Edit your CMakeLists:

find_package(OpenCV REQUIRED)

add_executable(vpnode
  src/vpnode.cpp
)
target_link_libraries(vpnode
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

Edit your sourcefile as follow:

#include <iostream>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char* argv[])  {
    cv::Mat img = cv::imread("/home/andrija/Documents/image.jpg");

    std::cout << img.rows << "; " << img.cols <<  std::endl;

    cv::namedWindow("img");
    cv::imshow("img", img);

    cv::waitKey(2000);    
    return 0; 
}

I don't know if you need videoio later but for now you don't, so comment it till you solve segmentation fault (core dumped) problem.

Edit your CMakeLists:

find_package(OpenCV REQUIRED)

add_executable(vpnode
  src/vpnode.cpp
)
target_link_libraries(vpnode
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

Edit your sourcefile as follow:

#include <iostream>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char* argv[])  {
    cv::Mat img = cv::imread("/home/andrija/Documents/image.jpg");
cv::imread("/home/andrija/Documents/image.jpg"); //Make sure that the image is there

    std::cout << img.rows << "; " << img.cols <<  std::endl;

    cv::namedWindow("img");
    cv::imshow("img", img);

    cv::waitKey(2000);    
    return 0; 
}

I don't know if you need videoio later but for now you don't, so comment it till you solve segmentation fault (core dumped) problem.

Edit your CMakeLists:

find_package(OpenCV REQUIRED)

add_executable(vpnode
  src/vpnode.cpp
)
target_link_libraries(vpnode
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

Edit your sourcefile as follow:

#include <iostream>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char* argv[])  {
    cv::Mat img = cv::imread("/home/andrija/Documents/image.jpg"); //Make sure that the image is there

    std::cout << img.rows << "; " << img.cols <<  std::endl;

    cv::namedWindow("img");
    cv::imshow("img", img);

    cv::waitKey(2000);    
    return 0; 
}

You don't have to edit package.xml leave as it is, This file defines properties about the package such as the package name, version numbers, authors, maintainers, and dependencies on other catkin packages. here