MasteringOpenCV / code

Code for the book "Mastering OpenCV with Practical Computer Vision Projects" by Packt Publishing 2012.
Other
2.74k stars 1.65k forks source link

cannot mix incompatible qt library (version 0x40805) with this library (version 0x40804) #27

Closed Reena24 closed 10 years ago

Reena24 commented 10 years ago

How can i solve this compatibility issue in Windows 7 . Though i have opengl support the next error it shows is this 3

if i am to downgrade or upgrade it i would like to know where i should download from and the proper steps involved

BloodAxe commented 10 years ago

Sorry, all telepaths are in vacation.. Without a context it's hard to say what is wrong. According to this output, there is version conflict of Qt versions (4.8.5 and 4.8.4). You configured OpenCV to use Qt, did you?

Reena24 commented 10 years ago

Yeah i did configure OpenCV to use Qt. But how to i remove version 4.8.4 since i am new to opencv i dont know how to solve the problem. I configured opencv according yo the instructions in http://docs.opencv.org/2.4.4/doc/tutorials/introduction/windows_install/windows_install.html#installation-by-making-your-own-libraries-from-the-source-files which enables the Qt version. I downloaded qt-everywhere-opensource-src-4.8.5 from http://qt-project.org/downloads and extracted it in a qt folder for which i have configured according to the instruction. I really want some help cause am stuck with trying to execute the code for past three weeks. I tried to execute a simple program to check the problem. This is the sample code i tried.

include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[]) { return 0; }

include <opencv2\core\core.hpp>

include <opencv2\highgui\highgui.hpp>

include <opencv2/core/opengl_interop.hpp>

include

include "E:\OpenCV\Build\cvconfig.h"

ifndef HAVE_OPENGL

int main() { std::cerr << "Library was built without OpenGL support" << std::endl; return -1; }

else

ifdef WIN32

#define WIN32_LEAN_AND_MEAN 1
#define NOMINMAX 1
#include <windows.h>

endif

if defined(APPLE)

#include <OpenGL/gl.h>
#include <OpenGL/glu.h>

else

#include <GL/gl.h>
#include <GL/glu.h>

endif

using namespace cv; using namespace std; void on_opengl(void* userdata);

int main(void) { VideoCapture webcam(CV_CAP_ANY);

namedWindow("window", CV_WINDOW_OPENGL);

Mat frame;
ogl::Texture2D tex;

setOpenGlDrawCallback("window", on_opengl, &tex);

while(waitKey(30) < 0)
{
    webcam >> frame;
    tex.copyFrom(frame);
    updateWindow("window");
}

setOpenGlDrawCallback("window", 0, 0);
destroyAllWindows();

return 0;

}

void on_opengl(void* userdata) { ogl::Texture2D* pTex = static_castogl::Texture2D*(userdata); if (pTex->empty()) return;

glLoadIdentity();

glTranslated(0.0, 0.0, 1.0);

glRotatef( 55, 1, 0, 0 );
glRotatef( 45, 0, 1, 0 );
glRotatef( 0, 0, 0, 1 );

static const int coords[6][4][3] = {
    { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
    { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
    { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
    { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
    { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
    { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
};

glEnable(GL_TEXTURE_2D);
pTex->bind();

for (int i = 0; i < 6; ++i) {
            glColor3ub( i*20, 100+i*10, i*42 );
            glBegin(GL_QUADS);
            for (int j = 0; j < 4; ++j) {
                    glVertex3d(0.2*coords[i][j][0], 0.2 * coords[i][j][1], 0.2*coords[i][j][2]);
            }
            glEnd();
}

}

endif

The code displays an error when it reaches the line namedWindow("window", CV_WINDOW_OPENGL); and setOpenGlDrawCallback("window", on_opengl, &tex); . The same error comes when i try for the MarkerlessAR code at the same point. Could you please help solve this error. Please.

Reena24 commented 10 years ago

Also i have 2 versions of Microsoft sdk C:\Program Files\Microsoft SDKs\Windows\v6.0A (old version) C:\Program Files\Microsoft SDKs\Windows\v6.1 (new version ) am not sure which opengl version is being conisidered

madduci commented 10 years ago

Just remove all Qt versions you have, download the base 4.8.0 and recompile OpenCV with 4.8.0.

On Windows, latest Qt makes problems, unless you switch to Linux

Reena24 commented 10 years ago

But where can i get 4.8.0 source code version from. I tried to search for 4.8.4 and i couldn't find the link

Reena24 commented 10 years ago

Also I have a doubt if i install 4.8.0 will it show compatibility problem again. Could i get some link where i can download it from

madduci commented 10 years ago

You just look on Qt website and select "previous versions". On www.pointclouds.org in Download section there is the link to Qt 4.8.0 for MSVC2010 Am 10.02.2014 18:13 schrieb "Reena24" notifications@github.com:

Also I have a doubt if i install 4.8.0 will it show compatibility problem again. Could i get some link where i can download it from

Reply to this email directly or view it on GitHubhttps://github.com/MasteringOpenCV/code/issues/27#issuecomment-34656152 .

Reena24 commented 10 years ago

Thanks a lot i reconfigured using Qt 4.8.4 and now its executing with no problems.

BloodAxe commented 10 years ago

Glad to hear!

Reena24 commented 10 years ago

Thanks a lot my Markerless AR code has finally started to execute but i cant understand one thing why does the cube keep on moving when using an image and camera as input