warpaffine crashes on certain hardware?

asked 2013-02-01 04:09:36 -0500

we have a licence plate detector running with opencv 2.4.2, and while everything runs smoothly, on one machine we had a crash in warpaffine. i have created a small test program and while it did run properly on my machine, it did not so on the other one (customer). it could be a very strange hardware-bug, but as the rest of the software using other opencv-routines runs rock-stable, i am not sure about this. or my code has a bug? but it runs without stress on 3 other machines we have tested. all code is 32bit, the machine where it crashes is an windows xp sp2 machine. the image i use is a normal RGB png, 2048x1536 (but also 720x480 crashes). i also tested it with opencv 2.4.3, same thing.

so, if anyone can spot anything suspicious, i'd be very thankful.

here is the full sourcecode (sorry, its windowish)

// sourcecode


#include <stdio.h>
#include <tchar.h>
#include <iostream>


#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>


int _tmain ( int argc, _TCHAR *argv[] )
{
    double dRotationAngle = 0.0;

    // read image
    cv::Mat srcImage = cv::imread ("test.png");

    for (unsigned int p = 0; 0 < 3024; p++)
    {
        dRotationAngle += 1.0f;

        std::cout << "Rotating.";
        cv::Mat tmpImage;

        // temporary matrix
        cv::Mat pTmp = cv::Mat (srcImage.rows << 1,  srcImage.cols << 1, CV_8U, cv::Scalar (255, 192, 159) );

        // create rotation matrix for rotation around image center of iAngle degrees
        cv::Point rCenter = cv::Point ( srcImage.cols >> 1, srcImage.rows >> 1 );
        cv::Mat pRotMat = cv::getRotationMatrix2D ( rCenter, dRotationAngle, 1.0 );

        std::cout << "Created Rotation matrix\n";
        // manipulate the rotation matrix so that we add a translation vector to the destination image
        pRotMat.at<double> (0, 2) += (double) pTmp.cols * 0.25;
        pRotMat.at<double> (1, 2) += (double) pTmp.rows * 0.25;

        // then rotate
        std::cout << "Starting warpAffine\n";
        cv::warpAffine ( srcImage, pTmp, pRotMat, pTmp.size(), cv::INTER_LINEAR, cv::BORDER_CONSTANT, cv::Scalar ( 159, 192, 255) );
        std::cout << "Stopping warpAffine\n";
    }

    return 0;
}
edit retag flag offensive close merge delete

Comments

sorry, i forgot to mention two things: a) it crashes on the very first call of warpaffine (the loop is unnecessary) and trying to catch some exception does not work either, seems to be a very hard crash.

aydin demircioglu gravatar imageaydin demircioglu ( 2013-02-01 04:12:33 -0500 )edit