Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Dilation produces translation and doesn't work

Whenever I use dilation, the result contains no dilation, but is simply the input image, that is translated (moved) downward to the right. I do not get any errors during compilation or runtime. Using the exact same code, my friend gets the correct result. AFAIK, his setup is identical to mine. His hardware is also the same. Obviously, something is wrong with my installation, and I want to fix it. Any help is greatly appreciated.

My setup:

  • Windows 7 ultimate (64-bit)
  • Visual C++ 2010 Express
  • OpenCV 2.4.3 (downloaded, not built)

I have included the code below, and the getBuildInformation.

#include <opencv\cv.h>
#include <opencv\highgui.h>

int main(){
    cv::Mat image = cv::imread("C:\\OpenCV2.4.3\\doc\\opencv-logo.png",0);

    cv::imshow("1", image);
    cv::imwrite("1.png",image);

    cv::threshold(image,image,200,255,1);

    cv::imshow("2", image);
    cv::imwrite("2.png",image);

    cv::dilate(image, image, cv::Mat(cv::Size(50,50),CV_8UC1));

    cv::imshow("3", image);
    cv::imwrite("3.png",image);

    printf("%s",cv::getBuildInformation());

    for(;;){
        if(cv::waitKey(1) >= 0) return 0;
    }
    return 0;
}

General configuration for OpenCV 2.4.3 =====================================
  Version control:               commit:6484732

  Platform:
    Host:                        Windows 6.1 x86
    CMake:                       2.8.9
    CMake generator:             Visual Studio 10
    CMake build tool:            C:/PROGRA~2/MICROS~2.0/Common7/IDE/devenv.com
    MSVC:                        1600

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4  /EHa /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /MP4  /MD /O2 /Ob2 /D NDEBUG
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4  /EHa /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3   /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /MD /O2 /Ob2 /D NDEBUG
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3   /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1
    Linker flags (Release):      /STACK:10000000 /machine:X86   /INCREMENTAL:NO
    Linker flags (Debug):        /STACK:10000000 /machine:X86   /debug /INCREMENTAL
    Precompiled headers:         YES

  OpenCV modules:
    To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree photo legacy gpu stitching ts videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 androidcamera java ocl python

  GUI:
    QT 4.x:                      NO
    Win32 UI:                    YES
    OpenGL support:              NO

  Media I/O:
    ZLib:                        build (ver 1.2.7)
    JPEG:                        build (ver 62)
    PNG:                         build (ver 1.5.12)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)

  Video I/O:
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 53.61.100)
      format:                    YES (ver 53.32.100)
      util:                      YES (ver 51.35.100)
      swscale:                   YES (ver 2.1.100)
      gentoo-style:              YES
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    XIMEA:                       NO

  Other third-party libraries:
    Use IPP:                     NO
    Use TBB:                     NO
    Use C=:                      NO
    Use Cuda:                    NO
    Use OpenCL:                  NO
    Use Eigen:                   NO

  Python:
    Interpreter:                 C:/Python27/python.exe (ver 2.7.2)

  Documentation:
    Build Documentation:         YES
    Sphinx:                      c:/Python27/Scripts/sphinx-build.exe (ver 1.1.3)
    PdfLaTeX compiler:           C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/pdflatex.exe

  Tests and samples:
    Tests:                       YES
    Performance tests:           YES
    Examples:                    NO

  Install path:                  C:/slave/WinInstallerMegaPack/build/install

  cvconfig.h is in:              C:/slave/WinInstallerMegaPack/build
-----------------------------------------------------------------

Dilation produces translation and doesn't work

Whenever I use dilation, the result contains no dilation, but is simply the input image, that is translated (moved) downward to the right. I do not get any errors during compilation or runtime. Using the exact same code, my friend gets the correct result. AFAIK, his setup is identical to mine. His hardware is also the same. Obviously, something is wrong with my installation, and I want to fix it. Any help is greatly appreciated.

My setup:

  • Windows 7 ultimate (64-bit)
  • Visual C++ 2010 Express
  • OpenCV 2.4.3 (downloaded, not built)

I have included the code below, and the getBuildInformation.

#include <opencv\cv.h>
#include <opencv\highgui.h>

int main(){
    cv::Mat image = cv::imread("C:\\OpenCV2.4.3\\doc\\opencv-logo.png",0);

    cv::imshow("1", image);
    cv::imwrite("1.png",image);

    cv::threshold(image,image,200,255,1);

    cv::imshow("2", image);
    cv::imwrite("2.png",image);

    cv::dilate(image, image, cv::Mat(cv::Size(50,50),CV_8UC1));

    cv::imshow("3", image);
    cv::imwrite("3.png",image);

    printf("%s",cv::getBuildInformation());

    for(;;){
        if(cv::waitKey(1) >= 0) return 0;
    }
    return 0;
}

General configuration for OpenCV 2.4.3 =====================================
  Version control:               commit:6484732

  Platform:
    Host:                        Windows 6.1 x86
    CMake:                       2.8.9
    CMake generator:             Visual Studio 10
    CMake build tool:            C:/PROGRA~2/MICROS~2.0/Common7/IDE/devenv.com
    MSVC:                        1600

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4  /EHa /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /MP4  /MD /O2 /Ob2 /D NDEBUG
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4  /EHa /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3   /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /MD /O2 /Ob2 /D NDEBUG
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3   /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1
    Linker flags (Release):      /STACK:10000000 /machine:X86   /INCREMENTAL:NO
    Linker flags (Debug):        /STACK:10000000 /machine:X86   /debug /INCREMENTAL
    Precompiled headers:         YES

  OpenCV modules:
    To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree photo legacy gpu stitching ts videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 androidcamera java ocl python

  GUI:
    QT 4.x:                      NO
    Win32 UI:                    YES
    OpenGL support:              NO

  Media I/O:
    ZLib:                        build (ver 1.2.7)
    JPEG:                        build (ver 62)
    PNG:                         build (ver 1.5.12)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)

  Video I/O:
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 53.61.100)
      format:                    YES (ver 53.32.100)
      util:                      YES (ver 51.35.100)
      swscale:                   YES (ver 2.1.100)
      gentoo-style:              YES
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    XIMEA:                       NO

  Other third-party libraries:
    Use IPP:                     NO
    Use TBB:                     NO
    Use C=:                      NO
    Use Cuda:                    NO
    Use OpenCL:                  NO
    Use Eigen:                   NO

  Python:
    Interpreter:                 C:/Python27/python.exe (ver 2.7.2)

  Documentation:
    Build Documentation:         YES
    Sphinx:                      c:/Python27/Scripts/sphinx-build.exe (ver 1.1.3)
    PdfLaTeX compiler:           C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/pdflatex.exe

  Tests and samples:
    Tests:                       YES
    Performance tests:           YES
    Examples:                    NO

  Install path:                  C:/slave/WinInstallerMegaPack/build/install

  cvconfig.h is in:              C:/slave/WinInstallerMegaPack/build
-----------------------------------------------------------------