error setting pixformat
Regards.
I'm using Roscpp + opencv (Ros-Hydro), which have connected my webcam via USB port and when you want to perform the capture of images of the camera gives me the following errors
- libv4l2: error setting pixformat: Device or resource busy
- HIGHGUI ERROR: unable to ioctl libv4l S_FMT
- libv4l2: error setting pixformat: Device or resource busy
- libv4l1: error setting pixformat: Device or resource busy
- libv4l2: error setting pixformat: Device or resource busy
- libv4l1: error setting pixformat: Device or resource busy
- HIGHGUI ERROR: unable to ioctl libv4l VIDIOCSPICT
codesistemavisual: /home/user/catkinws/src/beginnertutorials/src/codesistemavisual.cpp:173: int main(int, char): Assertion `cam' failed. Aborted (core dumped)
Not if someone could give me some solution to the problem.
Asked by Keiser30 on 2015-06-02 22:28:57 UTC
Answers
You must use the CvCapture, I used the part of the tutorial images Converting Between ROS and OpenCV images, which is in this link
And that can be seen below in the code, and the part that is highlighted is the one that gets the image.
void imageCb(const sensor_msgs::ImageConstPtr& msg)
{
cv_bridge::CvImagePtr cv_ptr;
try
{
**cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);**
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
// Draw an example circle on the video stream
if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
cv::circle(cv_ptr->image, cv::Point(50, 50), 10, CV_RGB(255,0,0));
// Update GUI Window
**cv::imshow(OPENCV_WINDOW, cv_ptr->image);**
cv::waitKey(3);
// Output modified video stream
image_pub_.publish(cv_ptr->toImageMsg());
}
};
Asked by Keiser30 on 2016-07-02 11:24:35 UTC
Comments