Hi, I'm using yuyv format webcams. Here is my code.
#include <iostream>
#include <opencv2/opencv.hpp>
#include <ros/ros.h>
#include <cv_bridge/cv_bridge.h>
#define FPS 30
using namespace std;
int main(int argc, char** argv){
std::cout << "stereo_cam_node" << std::endl;
ros::init(argc, argv, "stereo_cam");
ros::NodeHandle node;
cv::VideoCapture left_capture(1);
cv::VideoCapture right_capture(0);
if(!left_capture.isOpened() && !right_capture.isOpened()){
std::cerr << "Cameras are not working" << std::endl;
return 0;
}
while(ros::ok()){
cv::Mat left_mat, right_mat;
left_capture >> left_mat;
right_capture >> right_mat;
cv::imshow("left", left_mat);
cv::imshow("right", right_mat);
cv::waitKey(10);
}
return 0;
}
It seems to works well with imshow GUI but the terminal says that
stereo_cam_node
Corrupt JPEG data: 6 extraneous bytes before marker 0x8a
Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
init done
Corrupt JPEG data: 3 extraneous bytes before marker 0x8a
Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
Corrupt JPEG data: 3 extraneous bytes before marker 0xd9
Corrupt JPEG data: 2 extraneous bytes before marker 0xd9
Corrupt JPEG data: 4 extraneous bytes before marker 0x40
Corrupt JPEG data: 3 extraneous bytes before marker 0xd9
Corrupt JPEG data: 1 extraneous bytes before marker 0x4a
Corrupt JPEG data: 1727 extraneous bytes before marker 0xd9
Corrupt JPEG data: 1 extraneous bytes before marker 0x8a
Corrupt JPEG data: 5 extraneous bytes before marker 0x25
Corrupt JPEG data: 1905 extraneous bytes before marker 0x74
Corrupt JPEG data: 280 extraneous bytes before marker 0xd9
Shall I just ignore these messages or should I fix something?