Ask Your Question

JMorgie's profile - activity

2018-01-16 06:58:17 -0600 received badge  Famous Question (source)
2017-02-10 09:04:59 -0600 received badge  Notable Question (source)
2016-11-30 02:45:12 -0600 received badge  Popular Question (source)
2016-11-21 08:33:30 -0600 received badge  Student (source)
2016-05-29 18:44:32 -0600 asked a question cudalegacy not compile -- nppiGraphcut missing

trying to build v3.1 opencv with cuda support. standard cmake.
project of: opencv_cudalegacy and doing 'Build'

    1>------ Build started: Project: opencv_cudalegacy, Configuration: Debug x64 ------
1>  graphcuts.cpp
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(120): error C2061: syntax error: identifier 'NppiGraphcutState'
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(135): error C2833: 'operator NppiGraphcutState' is not a recognized operator or type
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(135): error C2059: syntax error: 'newline'
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(136): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(141): error C2143: syntax error: missing ';' before '*'
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(141): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(141): error C2238: unexpected token(s) preceding ';'
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(127): error C2065: 'pState': undeclared identifier
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(132): error C2065: 'pState': undeclared identifier
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(132): error C3861: 'nppiGraphcutFree': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(174): error C3861: 'nppiGraphcutGetSize': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(182): error C2065: 'nppiGraphcutInitAlloc': undeclared identifier
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(190): error C3861: 'nppiGraphcut_32s8u': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(195): error C3861: 'nppiGraphcut_32f8u': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(246): error C3861: 'nppiGraphcut8GetSize': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(254): error C2065: 'nppiGraphcut8InitAlloc': undeclared identifier
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(264): error C3861: 'nppiGraphcut8_32s8u': identifier not found
1>V:\Opencv31\opencv\sources\modules\cudalegacy\src\graphcuts.cpp(271): error C3861: 'nppiGraphcut8_32f8u': identifier not found
2>------ Build started: Project: opencv_cudaoptflow, Configuration: Debug x64 ------
2>LINK : warning LNK4044: unrecognized option '/LV:/NVIDIA GPU Computing Toolkit/Cuda8/lib/x64'; ignored
2>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\opencv_cudalegacy310d.lib'

2 Problems:

  • where are the identifiers for all the 'nppiGraphcut' symbols ?
  • who or where is the command to link in opencv_cudalegacy310d.lib ? why is this being referenced here? i have searched and cannot find where this /L command is found.

thanks

2016-05-26 23:44:51 -0600 answered a question matchTemplate c++ exception first time only

More Data: I spent the day compiling debug version of openCL [ v3.1 ] into static libraries. Here is what i have learned: * the problem i was stuck with -- matchTemplate crashing -- now works fine, no crash * but there is now an earlier crash long before any call to match Template. * I have tracked this thru to line 274 of opencl_core.cpp; * my program is calling cv::extractChannel to get channel zero of an RGB image [which looks just fine in ImageWatch]. this goes to useOpenCL which then calls HaveOpenCL which then calls opencl_check_fn which as you can see in the gifs declares the function clGetPlatformDs as not present and throws the memory fault.

Here are the gifs: C:\fakepath\useOpenCL_1.GIF OpenCL C:\fakepath\haveOpenCL.GIF haveOpenCL C:\fakepath\opencl_check_fn.GIF check function A C:\fakepath\check_fn_B.GIF check function B C:\fakepath\check_fn_C_smoking_gun.GIF smoking gun

I leave it to the opencl code gurus to figure out what this is crashing here, especially as it wasnt crashing using the non-debug libraries.

2016-05-26 07:37:11 -0600 received badge  Enthusiast
2016-05-25 11:30:22 -0600 commented question matchTemplate c++ exception first time only

my guess is that there is some var in matchTemplate or its subsidiarys that is not properly initialized which is why the first time use fails but after that it proceeds fine. i posted this question to see if one of the developers wanted to try and trace this.

2016-05-25 11:29:09 -0600 commented question matchTemplate c++ exception first time only

no opencl anywhere.

2016-05-24 07:47:50 -0600 commented question matchTemplate c++ exception first time only

a) how does one post code ? i tried using the 'preformatted text' button but the code got inserted without <cr> or formatting. Also why does the 2nd gif not get linked ?

2016-05-24 07:29:24 -0600 commented question matchTemplate c++ exception first time only

i do not understand why the 2nd gif is not showing ... i can show more code but i have 8,000 lines of code scattered over 5 modules and i cant post it all.

2016-05-23 13:59:41 -0600 commented question matchTemplate c++ exception first time only

The relevant code is in the screenshot -- matchTemplate only relies on the arguements passed, right?. both of the images also shown, so its not that the images are empty.. btw, the 'live' is the second frame -- the first provided the reference [template] image.

2016-05-23 11:32:07 -0600 received badge  Editor (source)
2016-05-23 11:26:02 -0600 asked a question 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

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();
                ...
2016-01-02 12:21:37 -0600 asked a question Visual Studio matchtemplate memory fault first call only`

I am processing a set of >3000 images of same size changing template every 300 images.

code snippet:

    cv::Mat inTplate, cFrame, Cresult;
    Cresult.create(resultH, resultW, IPL_DEPTH_32F); cFrame(rect).copyTo(inTplate); 

    // this part executed for every frame 
     matchTemplate(cFrame, inTplate, Cresult, CV_TM_CCORR_NORMED);  
     minMaxLoc(Cresult, &minVal, &maxVal, &minLoc, &maxLoc, Mat());

also: rect = ( 250, 20, 1420, 1040); and resultH = 41; resultW = 501;

the very first time thru the code, the call to matchTemplate throws a memory fault that i believe comes from combase.dll and references an address that is not in the space for any of the three matrices: cFrame, inTplate or Cresult.

Also the sizes for the three matrices are consistent: cFrame 1080 rows X 1920 cols, inTplate 1040 rows X 1420 cols; Cresult is 41 rows X 501 cols. yes the first time inTplate is a region of cFrame; thereafter cFrame is the next image read in.

answers coming back from matchTemplate are correct -- i have verified that the matching is correct. And the memory fault occurs ONLY on the very first call, not on any of the subsequent frames

Am I doing something wrong or am i looking at a bug in OpenCV ?