Skip to content

Instantly share code, notes, and snippets.

@tomoaki0705
Last active April 16, 2020 02:36
Show Gist options
  • Save tomoaki0705/ec1c89d63d742505a4c55d938045fae9 to your computer and use it in GitHub Desktop.
Save tomoaki0705/ec1c89d63d742505a4c55d938045fae9 to your computer and use it in GitHub Desktop.
test failure of opencv_test_objdetect
  • Tets passes on ODROID-XU4
  • Still, it fails on Jetson TX2
  • Both in Debug mode
  • Needed break points
2       breakpoint     keep y   0x0002f12e in opencv_test::(anonymous namespace)::Objdetect_QRCode_Close_regression_Test::Body()
                                           at /home/odroid/opencv-fork/modules/objdetect/test/test_qrcode.cpp:283
        breakpoint already hit 1 time
3       breakpoint     keep y   0xb6f7a6bc in cv::QRCodeDetector::detectAndDecode[abi:cxx11](cv::_InputArray const&, cv::_OutputArray const&, cv
::_OutputArray const&) at /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp:1245
4       breakpoint     keep y   0xb6f78e10 in cv::QRCodeDetector::detect(cv::_InputArray const&, cv::_OutputArray const&) const
                                           at /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp:947
bool QRCodeDetector::detect(InputArray in, OutputArray points) const
{
    Mat inarr;
    if (!checkQRInputImage(in, inarr))
        return false;

    QRDetect qrdet;
    qrdet.init(inarr, p->epsX, p->epsY);
    if (!qrdet.localization()) { return false; }
    if (!qrdet.computeTransformationPoints()) { return false; }
    vector<Point2f> pnts2f = qrdet.getTransformationPoints();
    updatePointsResult(points, pnts2f);
    return true;
}
  • It differs here /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:954
bool QRCodeDetector::detect(InputArray in, OutputArray points) const
{
    Mat inarr;
    if (!checkQRInputImage(in, inarr))
        return false;

    QRDetect qrdet;
    qrdet.init(inarr, p->epsX, p->epsY);
    if (!qrdet.localization()) { return false; }
    if (!qrdet.computeTransformationPoints()) { return false; } <<<<========== here
    vector<Point2f> pnts2f = qrdet.getTransformationPoints();
    updatePointsResult(points, pnts2f);
    return true;
}

Passed on ODROID-XU4

(gdb) b 578
Breakpoint 3 at 0xb6f76c42: file /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp, line 578.
(gdb) c
Continuing.

Thread 1 "opencv_test_obj" hit Breakpoint 3, cv::QRDetect::computeTransformationPoints (this=0xbeffec58)
    at /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp:578
(gdb) p down_left_edge_point
$1 = {x = 1220, y = 41}
(gdb) p up_right_edge_point
$2 = {x = 231, y = 1006}
(gdb) p new_non_zero_elem[0]
$3 = std::vector of length 5, capacity 8 = {{x = 239, y = 275}, {x = 243, y = 101}, {x = 245, y = 15}, {x = 334, y = 15}, {x = 518, y = 19}}

Failed on Jetson TX2

(gdb) b 578
Breakpoint 3 at 0x7fb7f5c7d0: file /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp, line 578.
(gdb) fin
Run till exit from #0  cv::QRDetect::computeTransformationPoints (this=0x7fffffe838)
    at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:521

Breakpoint 3, cv::QRDetect::computeTransformationPoints (this=0x7fffffe838) at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:578
(gdb) p down_left_edge_point
$1 = {x = 1216, y = 502}
(gdb) p up_right_edge_point
$2 = {x = 549, y = 1007}
(gdb) p new_non_zero_elem[0]
$3 = std::vector of length 5, capacity 8 = {{x = 716, y = 378}, {x = 834, y = 340}, {x = 841, y = 340}, {x = 869, y = 341}, {x = 986, y = 382}}

passed on ODROID-XU4

(gdb) b 637
Breakpoint 4 at 0xb6f77054: file /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp, line 637.
(gdb) c
Continuing.

Thread 1 "opencv_test_obj" hit Breakpoint 4, cv::QRDetect::computeTransformationPoints (this=0xbeffec58)
    at /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp:637
(gdb) p transformation_points
$4 = std::vector of length 4, capacity 4 = {{x = 245.021484, y = 13.0656843}, {x = 1220, y = 41}, {x = 1212.99988, y = 1005.99994}, {x = 231,
    y = 1006}}
(gdb) p width
$5 = 1820
(gdb) p height
$6 = 1024
(gdb) p height
$7 = 1024
(gdb) p width
$8 = 1820

failed on Jetson TX2

(gdb) b 637
Breakpoint 4 at 0x7fb7f5cc30: file /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp, line 637.
(gdb) c
Continuing.

Breakpoint 4, cv::QRDetect::computeTransformationPoints (this=0x7fffffe838) at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:637
(gdb) p transformation_points
$4 = std::vector of length 4, capacity 4 = {{x = 716, y = 378}, {x = 1216, y = 502}, {x = 540, y = 1735}, {x = 549, y = 1007}}
Bottom (innermost) frame selected; you cannot go down.
(gdb) p height
$5 = 1024
(gdb) p width
$6 = 1820
    for (size_t i = 0; i < transformation_points.size(); i++)
    {
        if ((cvRound(transformation_points[i].x) > width) ||
            (cvRound(transformation_points[i].y) > height)) { return false; }
    }
    return true;
  • break points
(gdb) info b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000007fb7f5f120 in cv::QRCodeDetector::detect(cv::_InputArray const&, cv::_OutputArray const&) const
                                                   at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:954
        breakpoint already hit 1 time
3       breakpoint     keep y   0x0000007fb7f5c7d0 in cv::QRDetect::computeTransformationPoints()
                                                   at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:578
        breakpoint already hit 1 time
4       breakpoint     keep y   0x0000007fb7f5cc30 in cv::QRDetect::computeTransformationPoints()
                                                   at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:637
        breakpoint already hit 1 time

intermediate

  • Let's check up to here
    convexHull(newHull, locations);

differs much more before

  • it already differs here
bool QRDetect::computeTransformationPoints()
{
    CV_TRACE_FUNCTION();
    if (localization_points.size() != 3) { return false; }
ODROID-XU4 Jetson TX2
{x = 381, y = 154} {x = 701.5, y = 342.333344}
{x = 1086, y = 169.800003} {x = 1102, y = 614.600037}
{x = 372.000031, y = 867.000061} {x = 611, y = 808}

ODROID-XU4

Thread 1 "opencv_test_obj" hit Breakpoint 3, cv::QRDetect::computeTransformationPoints (this=0xbeffec58)
    at /home/odroid/opencv-fork/modules/objdetect/src/qrcode.cpp:518
(gdb) p localization_points
$2 = std::vector of length 3, capacity 3 = {{x = 381, y = 154}, {x = 1086, y = 169.800003}, {x = 372.000031, y = 867.000061}}

Jetson TX2

Breakpoint 3, cv::QRDetect::computeTransformationPoints (this=0x7fffffe838) at /home/nvidia/opencv-fork/modules/objdetect/src/qrcode.cpp:518
(gdb) p localization_points
$2 = std::vector of length 3, capacity 3 = {{x = 701.5, y = 342.333344}, {x = 1102, y = 614.600037}, {x = 611, y = 808}}

beginning of localization

bool QRDetect::localization()
{
    CV_TRACE_FUNCTION();
    Point2f begin, end;
    vector<Vec3d> list_lines_x = searchHorizontalLines();
    if( list_lines_x.empty() ) { return false; }
  • size of list_lines_x
ODROID-XU4 Jetson TX2
201 194

ODROID-XU4

$4 = std::vector of length 194, capacity 256 = {{<cv::Matx<double, 3, 1>> = {val = {244, 96, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {244, 97, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 98,
        278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 99, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 100, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 101, 278}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 102, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 103,
        278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 104, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 105, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 106, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 107, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 108,
        277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 109, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 110, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 111, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 112, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 113,
        277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 113, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 114, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 114, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 115, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 115,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {242, 116, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 116, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 117, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 118, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 119,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 120, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 121, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 122, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 123, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 124,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 125, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 126, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 127, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 128, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 129,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 130, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 131, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 132, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {481, 141, 264}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 142,
        265}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 143, 267}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        481, 144, 268}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 145, 268}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {481, 146, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 147,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 148, 268}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
---Type <return> to continue, or q <return> to quit---

Jetson TX2

$4 = std::vector of length 201, capacity 256 = {{<cv::Matx<double, 3, 1>> = {val = {244, 96, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {244, 97, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 98,
        278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 99, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 100, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 101, 278}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 102, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 103,
        277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 104, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 105, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 106, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 107, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 108,
        277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 109, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 110, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 111, 277}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 112, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {243, 113,
        277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 113, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        243, 114, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 114, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {243, 115, 277}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {953, 115,
        268}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {242, 116, 278}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 116, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 117, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 118, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 119,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 120, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 121, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 122, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 123, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 124,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 125, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 126, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 127, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {952, 128, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 129,
        269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 130, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        952, 131, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {952, 132, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {481, 141, 264}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 142,
        265}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 143, 267}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
        481, 144, 267}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 145, 269}}, <No data fields>},
  {<cv::Matx<double, 3, 1>> = {val = {481, 146, 269}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 147,
        270}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {481, 148, 267}}, <No data fields>}, {<cv::Matx<double, 3, 1>> = {val = {
---Type <return> to continue, or q <return> to quit---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment