Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Corrupt JPEG data error when using yuyv webcam

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?

Corrupt JPEG data error when using yuyv webcam

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?something? Also, I installed OpenCv 3.2 on NVIDIA Jetson TX1 with

cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DENABLE_PRECOMPILED_HEADERS=OFF \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN=5.3 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ..