Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

matchTemplate c++ crash first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIF(/upfiles/1464020655627660.gif)

matchTemplate c++ crash exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine. fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIF(/upfiles/1464020655627660.gif) .. [ screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIF .. [ screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIF .. ..


[ screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIF ..


..

[ screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)

click to hide/show revision 6
No.6 Revision

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. etc.

C:\fakepath\Capture2.GIF

..

[ screenshot (screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)culprit) C:\fakepath\Capture1.GIF

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc.

etc. C:\fakepath\Capture2.GIF (screenshot

..

[ screenshot failed to capture green arrow showing matchTemplate was the culprit) C:\fakepath\Capture1.GIFculprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)

bool E::runNewScan()
{    
    bool rc = false;
    double avgMatch;
    cv::Mat Redd;
    cv::extractChannel( cFrame, Redd, 0);
    if (firstBatch) {   // save template
        firstBatch = false;
        Redd (sectorRect).copyTo(scanTplate);
        if (Debug)
        { cv::imshow("ScanTemplate", scanTplate);   waitKey(keyWait); }
        rc = true;
    }  // first batch only
    else
    {
        //   test for new scan
        try {
                matchTemplate ( Redd, scanTplate, Cresult, CV_TM_CCORR_NORMED);  // correlation
        }
        catch (cv::Exception& e)
        {
            const char* err_what = e.what();
            std::cout << e.file << e.func << e.err << std::endl;
            std::cout << "exception caught: " << err_what << std::endl;
        }

        minMaxLoc(Cresult, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
        avgMatch = maxVal;  // minVal / tmplSize;   // is this a match ?        
    } // else not first batch

and gets called from:

                cv::Mat cFrame, Result;  // in scope of Object

                           ....

          while (!stop) {
            if (!capture.read(inFrame))
                break;
            FrameNo = static_cast<int> (capture.get(CAP_PROP_POS_FRAMES));
            if (FrameNo >= FrameCount)
                stop = true;
            else  // not stop
            {
                if (FrameNo >= rp.firstFrame ) 
                {   // process this one
                    cFrame = inFrame;
                    runNewScan();
                ...
click to hide/show revision 8
No.8 Revision

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. C:\fakepath\Capture2.GIFetc.

..

[ screenshot Capture2.GIF (screenshot failed to capture green arrow showing matchTemplate was the culprit] [C:\fakepath\Capture1.GIF](/upfiles/14640210367759221.gif)culprit)

bool E::runNewScan()
{    
    bool rc = false;
    double avgMatch;
    cv::Mat Redd;
    cv::extractChannel( cFrame, Redd, 0);
    if (firstBatch) {   // save template
        firstBatch = false;
        Redd (sectorRect).copyTo(scanTplate);
        if (Debug)
        { cv::imshow("ScanTemplate", scanTplate);   waitKey(keyWait); }
        rc = true;
    }  // first batch only
    else
    {
        //   test for new scan
        try {
                matchTemplate ( Redd, scanTplate, Cresult, CV_TM_CCORR_NORMED);  // correlation
        }
        catch (cv::Exception& e)
        {
            const char* err_what = e.what();
            std::cout << e.file << e.func << e.err << std::endl;
            std::cout << "exception caught: " << err_what << std::endl;
        }

        minMaxLoc(Cresult, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
        avgMatch = maxVal;  // minVal / tmplSize;   // is this a match ?        
    } // else not first batch

and gets called from:Capture1.GIF

                cv::Mat cFrame, Result;  // in scope of Object

                           ....

          while (!stop) {
            if (!capture.read(inFrame))
                break;
            FrameNo = static_cast<int> (capture.get(CAP_PROP_POS_FRAMES));
            if (FrameNo >= FrameCount)
                stop = true;
            else  // not stop
            {
                if (FrameNo >= rp.firstFrame ) 
                {   // process this one
                    cFrame = inFrame;
                    runNewScan();
                ...
click to hide/show revision 9
No.9 Revision

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc.

etc. Capture2.GIFC:\fakepath\Capture2.GIF (screenshot failed to capture green arrow showing matchTemplate was the culprit)

Capture1.GIFC:\fakepath\Capture1.GIF

bool E::runNewScan()
{    
    bool rc = false;
    double avgMatch;
    cv::Mat Redd;
    cv::extractChannel( cFrame, Redd, 0);
    if (firstBatch) {   // save template
        firstBatch = false;
        Redd (sectorRect).copyTo(scanTplate);
        if (Debug)
        { cv::imshow("ScanTemplate", scanTplate);   waitKey(keyWait); }
        rc = true;
    }  // first batch only
    else
    {
        //   test for new scan
        try {
                matchTemplate ( Redd, scanTplate, Cresult, CV_TM_CCORR_NORMED);  // correlation
        }
        catch (cv::Exception& e)
        {
            const char* err_what = e.what();
            std::cout << e.file << e.func << e.err << std::endl;
            std::cout << "exception caught: " << err_what << std::endl;
        }

        minMaxLoc(Cresult, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
        avgMatch = maxVal;  // minVal / tmplSize;   // is this a match ?        
    } // else not first batch

and gets called from:

                cv::Mat cFrame, Result;  // in scope of Object

                           ....

          while (!stop) {
            if (!capture.read(inFrame))
                break;
            FrameNo = static_cast<int> (capture.get(CAP_PROP_POS_FRAMES));
            if (FrameNo >= FrameCount)
                stop = true;
            else  // not stop
            {
                if (FrameNo >= rp.firstFrame ) 
                {   // process this one
                    cFrame = inFrame;
                    runNewScan();
                ...
click to hide/show revision 10
No.10 Revision

matchTemplate c++ exception first time only

running video file with several thousand frames. matchTemplate crashes only on the first time i call it, then runs fine every time afterwards. first time called, Live and template are two different frames. attached screenshots of input images, error messages. have had this behavior for months -- sometimes shows up sometimes program runs without the crash. suggestions what i can look at, tweak, etc. etc.

C:\fakepath\Capture2.GIF(screenshot failed to capture green arrow showing matchTemplate was the culprit)

C:\fakepath\Capture1.GIF

bool E::runNewScan()
{    
    bool rc = false;
    double avgMatch;
    cv::Mat Redd;
    cv::extractChannel( cFrame, Redd, 0);
    if (firstBatch) {   // save template
        firstBatch = false;
        Redd (sectorRect).copyTo(scanTplate);
        if (Debug)
        { cv::imshow("ScanTemplate", scanTplate);   waitKey(keyWait); }
        rc = true;
    }  // first batch only
    else
    {
        //   test for new scan
        try {
                matchTemplate ( Redd, scanTplate, Cresult, CV_TM_CCORR_NORMED);  // correlation
        }
        catch (cv::Exception& e)
        {
            const char* err_what = e.what();
            std::cout << e.file << e.func << e.err << std::endl;
            std::cout << "exception caught: " << err_what << std::endl;
        }

        minMaxLoc(Cresult, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
        avgMatch = maxVal;  // minVal / tmplSize;   // is this a match ?        
    } // else not first batch

and gets called from:

                cv::Mat cFrame, Result;  // in scope of Object

                           ....

          while (!stop) {
            if (!capture.read(inFrame))
                break;
            FrameNo = static_cast<int> (capture.get(CAP_PROP_POS_FRAMES));
            if (FrameNo >= FrameCount)
                stop = true;
            else  // not stop
            {
                if (FrameNo >= rp.firstFrame ) 
                {   // process this one
                    cFrame = inFrame;
                    runNewScan();
                ...