Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c936e2

Browse files
committed
Several bug fixes and linking OpenCV libs according to debug/release
1 parent be194e0 commit 3c936e2

File tree

6 files changed

+75
-38
lines changed

6 files changed

+75
-38
lines changed

cvDisplacementMapFilter/cvDisplacementMapFilter.pro

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ SOURCES += \
22
main.cpp
33

44
# On my system I have to specify g++ as compiler else it will use clang++ by default
5-
QMAKE_CXX=g++
6-
QMAKE_CC=gcc
5+
#QMAKE_CXX=g++
6+
#QMAKE_CC=gcc
77

88
## OpenCV settings for Unix/Linux
99
unix:!mac {
@@ -34,10 +34,19 @@ win32 {
3434
"C:\\opencv\\build\\include\\opencv" \
3535
"C:\\opencv\\build\\include\\opencv2"
3636

37-
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
38-
-lopencv_core242 \
39-
-lopencv_highgui242 \
40-
-lopencv_imgproc242
37+
CONFIG(debug, debug | release) {
38+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
39+
-lopencv_core248d \
40+
-lopencv_highgui248d \
41+
-lopencv_imgproc248d
42+
}
43+
44+
CONFIG(release, debug | release) {
45+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
46+
-lopencv_core248 \
47+
-lopencv_highgui248 \
48+
-lopencv_imgproc248
49+
}
4150
}
4251

4352
# Runs this app automatically after the building has succeeded

cvImage/cvImage.pro

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ TEMPLATE = app
33
QT += core gui
44

55
contains(QT_VERSION, ^5\\.[0-8]\\..*) {
6-
message("* Using Qt $${QT_VERSION}.")
7-
QT += widgets
6+
message("* Using Qt $${QT_VERSION}.")
7+
QT += widgets
88

9-
# On my system I have to specify g++ as compiler else it will use clang++ by default
10-
#QMAKE_CXX=g++
11-
#QMAKE_CC=gcc
9+
# On my system I have to specify g++ as compiler else it will use clang++ by default
10+
#QMAKE_CXX=g++
11+
#QMAKE_CC=gcc
1212
}
1313

1414
SOURCES += \
@@ -20,7 +20,7 @@ HEADERS += \
2020

2121
## OpenCV settings for Unix/Linux
2222
unix:!mac {
23-
message("* Using settings for Unix/Linux.")
23+
message("* Using settings for Unix/Linux.")
2424
INCLUDEPATH += /usr/local/include/opencv
2525

2626
LIBS += -L/usr/local/lib/ \
@@ -31,7 +31,7 @@ unix:!mac {
3131

3232
## OpenCV settings for Mac OS X
3333
macx {
34-
message("* Using settings for Mac OS X.")
34+
message("* Using settings for Mac OS X.")
3535
INCLUDEPATH += /usr/local/include/opencv
3636

3737
LIBS += -L/usr/local/lib/ \
@@ -42,15 +42,24 @@ macx {
4242

4343
## OpenCV settings for Windows and OpenCV 2.4.2
4444
win32 {
45-
message("* Using settings for Windows.")
45+
message("* Using settings for Windows.")
4646
INCLUDEPATH += "C:\\opencv\\build\\include" \
4747
"C:\\opencv\\build\\include\\opencv" \
4848
"C:\\opencv\\build\\include\\opencv2"
4949

50-
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
51-
-lopencv_core242 \
52-
-lopencv_highgui242 \
53-
-lopencv_imgproc242
50+
CONFIG(debug, debug | release) {
51+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
52+
-lopencv_core248d \
53+
-lopencv_highgui248d \
54+
-lopencv_imgproc248d
55+
}
56+
57+
CONFIG(release, debug | release) {
58+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
59+
-lopencv_core248 \
60+
-lopencv_highgui248 \
61+
-lopencv_imgproc248
62+
}
5463
}
5564

5665
# Runs this app automatically after the building has succeeded

cvQTcameraGL/cvQTcameraGL.pro

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ win32 {
4545
"C:\\opencv\\build\\include\\opencv" \
4646
"C:\\opencv\\build\\include\\opencv2"
4747

48-
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
49-
-lopencv_core242 \
50-
-lopencv_highgui242 \
51-
-lopencv_imgproc242
48+
CONFIG(debug, debug | release) {
49+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
50+
-lopencv_core248d \
51+
-lopencv_highgui248d \
52+
-lopencv_imgproc248d
53+
}
54+
55+
CONFIG(release, debug | release) {
56+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
57+
-lopencv_core248 \
58+
-lopencv_highgui248 \
59+
-lopencv_imgproc248
60+
}
5261
}
5362

cvQTcameraGL/widget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "widget.h"
2+
#include <GL/GLU.h>
23

34
#include <iostream>
45
#include <QKeyEvent>

cvVideo/cvVideo.pro

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ TEMPLATE = app
33
QT += core gui
44

55
contains(QT_VERSION, ^5\\.[0-8]\\..*) {
6-
message("* Using Qt $${QT_VERSION}.")
7-
QT += widgets
6+
message("* Using Qt $${QT_VERSION}.")
7+
QT += widgets
88

9-
# On my system I have to specify g++ as compiler else it will use clang++ by default
10-
#QMAKE_CXX=g++
11-
#QMAKE_CC=gcc
9+
# On my system I have to specify g++ as compiler else it will use clang++ by default
10+
#QMAKE_CXX=g++
11+
#QMAKE_CC=gcc
1212
}
1313

1414
HEADERS += \
@@ -20,7 +20,7 @@ SOURCES += \
2020

2121
## OpenCV settings for Unix/Linux
2222
unix:!mac {
23-
message("* Using settings for Unix/Linux.")
23+
message("* Using settings for Unix/Linux.")
2424
INCLUDEPATH += /usr/local/include/opencv
2525

2626
LIBS += -L/usr/local/lib/ \
@@ -31,7 +31,7 @@ unix:!mac {
3131

3232
## OpenCV settings for Mac OS X
3333
macx {
34-
message("* Using settings for Mac OS X.")
34+
message("* Using settings for Mac OS X.")
3535
INCLUDEPATH += /usr/local/include/opencv
3636

3737
LIBS += -L/usr/local/lib/ \
@@ -42,15 +42,24 @@ macx {
4242

4343
## OpenCV settings for Windows and OpenCV 2.4.2
4444
win32 {
45-
message("* Using settings for Windows.")
45+
message("* Using settings for Windows.")
4646
INCLUDEPATH += "C:\\opencv\\build\\include" \
4747
"C:\\opencv\\build\\include\\opencv" \
4848
"C:\\opencv\\build\\include\\opencv2"
4949

50-
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
51-
-lopencv_core242 \
52-
-lopencv_highgui242 \
53-
-lopencv_imgproc242
50+
CONFIG(debug, debug | release) {
51+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
52+
-lopencv_core248d \
53+
-lopencv_highgui248d \
54+
-lopencv_imgproc248d
55+
}
56+
57+
CONFIG(release, debug | release) {
58+
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
59+
-lopencv_core248 \
60+
-lopencv_highgui248 \
61+
-lopencv_imgproc248
62+
}
5463
}
5564

5665
# Runs this app automatically after the building has succeeded

cvVideo/cvWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ void cvWindow::_draw_video_frame(QPainter& painter)
114114

115115
QImage scaled_img = _image->scaled(QSize(width(), height()), Qt::KeepAspectRatio, Qt::FastTransformation);
116116

117-
painter.drawImage(qRound(width()/2) - qRound(scaled_img.size().width()/2),
118-
qRound(height()/2) - qRound(scaled_img.size().height()/2),
117+
painter.drawImage(qRound(width()/2.0) - qRound(scaled_img.size().width()/2.0),
118+
qRound(height()/2.0) - qRound(scaled_img.size().height()/2.0),
119119
scaled_img);
120120
}
121121
break;
@@ -126,8 +126,8 @@ void cvWindow::_draw_video_frame(QPainter& painter)
126126

127127
painter.drawImage(QRectF(QPoint(0, 0), QSize(width(), height())),
128128
scaled_img,
129-
QRectF(QPoint(qRound(scaled_img.size().width()/2) - qRound(width()/2),
130-
qRound(scaled_img.size().height()/2) - qRound(height()/2)),
129+
QRectF(QPoint(qRound(scaled_img.size().width()/2.0) - qRound(width()/2.0),
130+
qRound(scaled_img.size().height()/2.0) - qRound(height()/2.0)),
131131
QSize(width(), height())));
132132
}
133133
break;

0 commit comments

Comments
 (0)