Ask Your Question

mikegibson_dajac's profile - activity

2015-09-24 14:38:25 -0600 received badge  Teacher (source)
2015-09-24 12:42:13 -0600 received badge  Necromancer (source)
2015-09-24 12:25:02 -0600 commented answer Convert BayerBG12Packed (12-Bit packed) into RGB

I feel I should add that this is the same as multiplying the 12bit value by 16. And for speed, you could actually just bit shift it to the left by 4:

16bitVal = (12bitVal << 4);

2015-09-24 12:12:25 -0600 commented answer Convert BayerBG12Packed (12-Bit packed) into RGB

12 bit max = 4095, 16 bit max = 65535, right? So if you have a value that is 2048 in 12bit (4095max) (approx. 50%), it is 32767 (approx. 50%) in the 16 bit range. Or:

12bitVal / 12bitMax * 16bitMax

2048 / 4095 * 65535

2015-09-24 11:54:22 -0600 received badge  Editor (source)
2015-09-24 09:38:30 -0600 commented question Missing dll

What dll is it reporting?

2015-09-24 09:37:26 -0600 commented question Opencv with mingw and codeblock error

What is the error? What you have above is the notification of the error, but there should be a more specific error somewhere.

2015-09-24 09:31:10 -0600 answered a question Problems Building/Compiling OpenCV 3.0

Adding this for future people browsing the question:

4 errors in 'opencv/sources/modules/videoio/src/cap_dshow.cpp' pertaining to

ISampleGrabberCB, ISampleGrabber, IEnumPIDMap, and IMPEG2PIDMap.

Each of these interfaces needs a virtual destructor added to them (for example, in IEnumPIDMap, add virtual ~IEnumPIDMap(){} ). Adding these fixes the issues.

Conversely, I have noticed that there has been a fix for this MinGW problem submitted, and if you pull the latest revision from git, this problem should clear up.

2015-09-24 09:24:48 -0600 commented answer opencv 3.0 with contrib installation guide

I've been working on this guide for a couple of days now. Currently, I have everything working EXCEPT that I can't figure out how to get the debug versions of the static libraries. I've already posted a question for this.

2015-09-24 09:22:11 -0600 answered a question opencv 3.0 with contrib installation guide

Open CMake, and point it to the OpenCV sources directory.

Create a new folder under OpenCV called my_build.

Point CMake's "Where to build the binaries" field to the my_build folder.

Hit Configure. CMake will ask you about the compiler. If you want the CodeBlocks build, you should specify that it's MinGW for CodeBlocks, because OpenCV 's cmake file will output a CodeBlocks file that will help with compiling. You make need to specify the native compiler to match the compiler used for your project.

Once the Configure process has finished, everything should be in red. This does not indicate an error. CMake needs you to verify the configuration data.

1 - Find the "With" drop-down, and uncheck WITH_IPP (and IPP_A, if it is checked). These only work under Visual Studios. 2 - Under "Build", check BUILD_SHARED_LIBS for dlls, uncheck for .a 3 - Check under the "CMake" tab to make sure CMake hasn't changed any of your compiler options, as it often does. It changed 2 of mine. Check: CMAKE_AR, CMAKE_LINKER, CMAKE_MAKE_PROGRAM, NM, OBJCOPY, OBJDUMP, RANLIB, RC_COMPILER, STRIP

Click "Configure" again.

Any time you click configure, you should check all of the above options because CMake sometimes loses track of your settings. Once you have nothing else in red, and every option is correct, click Generate.

Navigate to the my_build directory under the OpenCV folder. You should see an OpenCV.cbp. Open it in CodeBlocks.

Configure CodeBlocks to use the same compiler that was specified in CMake.


You will most likely encounter 4 errors in 'opencv/sources/modules/videoio/src/cap_dshow.cpp' pertaining to ISampleGrabberCB, ISampleGrabber, IEnumPIDMap, and IMPEG2PIDMap. Each of these interfaces needs a virtual destructor added to them (for example, in IEnumPIDMap, add virtual ~IEnumPIDMap(){} ). Adding these fixes the issues.

Hit compile. Sit back and wait.

If you are using TDM as the compiler, you'll most likely encounter ANOTHER issue with libstdc++ claiming a whole mess of things are redefined/have multiple definitions. If this happens, go to your my_build directory in Cygwin, and run the following command:

grep -rl 'lstdc' ./ | xargs sed -i 's/lstdc/static-libstdc/g'

The command replaces a bunch of dynamic linking instances with statically linked instances of libstdc.

Hit compile to start compiling from where you left off.


Once the compile is done, in the my_build libraries, you will have a /lib/ with the .a's, and a /bin/ with the dlls

Create a new console project in CodeBlocks, and use the following code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv )
    if( argc != 2)
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;

    Mat image;
    image = imread(argv[1], IMREAD_COLOR); // Read the file

    if(! ) // Check for invalid input
        cout << "Could not open or find the image" << std::endl ;
        return -1;

    namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
    imshow( "Display window", image ); // Show our image inside it.

    waitKey(0); // Wait for a ...
2015-09-24 09:06:46 -0600 received badge  Autobiographer
2015-09-24 09:03:48 -0600 received badge  Organizer (source)
2015-09-24 09:02:58 -0600 asked a question Creating debug (static) libraries with CodeBlocks/MinGW


I've successfully used CMake to configure and generate a CodeBlocks/MinGW project for OpenCV. When I open up CodeBlocks, I am given many target options including "all". I am able to build "all", but using it does not create debug versions of the library. There is no target for debug, or all-debug, or anything like that.

When configuring CMake, I did tell it that there should be a Release and a Debug @ CMAKE->CMAKE_CONFIGURATION_TYPES=Debug;Release

And the CMAKE_CXX_FLAGS_DEBUG is correctly set to -g

Does anyone have any idea how to get the debug libraries out of a CodeBlocks based configuration?

2015-09-23 09:33:20 -0600 commented question Problems compiling with gcc due to #define interface struct

Sure looks like it. I made the mistake of assuming the opencv-3.0.0.exe install would be as up-to-date as necessary. Thanks!

2015-09-22 15:06:35 -0600 asked a question Problems compiling with gcc due to #define interface struct

Hello all,

I'm having a problem trying to compile OpenCV as a static library (though this info is probably not relevant to the issue).

When I compile, I get 4 errors, 1 each dealing with destructors in: interface ISampleGrabber : public IUnknown interface ISampleGrabberCB : public IUnknown interface IMPEG2PIDMap : public IUnknown interface IEnumPIDMap : public IUnknown

(these are in cap_dshow.cpp)

The easy fix is to add distructors to these interfaces (an interface is defined by gcc as a struct), but the question is, is why is this a problem for us, but doesn't seem to be a problem for anyone else? Is there a compile option to add virtual destructors to classes/structs when they are undefined, that we don't have set? Is there something else that we may be doing wrong that gives us errors? My boss is not happy simply fixing this error, but wants to know why we're getting it.

Any and all insight appreciated

2015-07-31 09:18:02 -0600 asked a question Compile failed: cannot find -lRunTmChk

Hello, I'm trying to compile OpenCV. I've followed the directions outlined here:

and I'm getting the following error:

Linking CXX shared library ....\bin\libopencv_core300.dll c:/progra~2/codebl~1/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -lRunTmChk collect2: ld returned 1 exit status make[2]: * [bin/libopencv_core300.dll] Error 1 make[1]: [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: ** [all] Error 2

If anyone can point me in the right direction, I'd be appreciative. And if more information is needed, I will try to provide.