Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit772a4c0

Browse files
committed
qt 5.13 test
1 parent914404d commit772a4c0

File tree

8 files changed

+118
-69
lines changed

8 files changed

+118
-69
lines changed

‎cv2/__init__.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# wildcard import above does not import "private" variables like __version__
99
# this makes them available
10-
globals().update(importlib.import_module('cv2.cv2').__dict__)
10+
globals().update(importlib.import_module("cv2.cv2").__dict__)
1111

1212
is_ci_build=False
1313

@@ -18,7 +18,7 @@
1818
pass
1919

2020
# the Qt plugin is included currently only in the pre-built wheels
21-
ifsys.platform=='darwin'andis_ci_build:
22-
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=os.path.join(
23-
os.path.dirname(os.path.abspath(__file__)),'qt','plugins'
21+
if(sys.platform=="darwin"orsys.platform.startswith("linux"))andis_ci_build:
22+
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"]=os.path.join(
23+
os.path.dirname(os.path.abspath(__file__)),"qt","plugins"
2424
)

‎cv2/data/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
importos
22

3-
haarcascades=os.path.join(os.path.dirname(__file__),'')
3+
haarcascades=os.path.join(os.path.dirname(__file__),"")

‎docker/manylinux2014/Dockerfile_i686‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
FROM quay.io/pypa/manylinux2014_i686:latest
22

3-
RUN yum install bzip2-devel curl-devel zlib-devel qt-devel -y
3+
RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel freetype-devel -y
4+
5+
RUN curl -O -L https://download.qt.io/official_releases/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz && \
6+
tar -xf qt-everywhere-src-5.13.2.tar.xz && \
7+
cd qt-everywhere* && \
8+
export MAKEFLAGS=-j$(nproc) && \
9+
./configure -prefix /opt/Qt5.13.2 -release -opensource -confirm-license -qtnamespace QtOpenCVPython -qt-xcb -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \
10+
make && \
11+
make install && \
12+
cd .. && \
13+
rm -rf qt-everywhere-src-5.13.2 && \
14+
rm qt-everywhere-src-5.13.2.tar.xz
15+
16+
ENV QTDIR /opt/Qt5.13.2
17+
ENV PATH "$QTDIR/bin:$PATH"
418

519
RUN mkdir ~/ffmpeg_sources && \
620
cd ~/ffmpeg_sources && \

‎docker/manylinux2014/Dockerfile_x86_64‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
FROM quay.io/pypa/manylinux2014_x86_64:latest
22

3-
RUN yum install bzip2-devel curl-devel zlib-devel qt-devel -y
3+
RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel freetype-devel -y
4+
5+
RUN curl -O -L https://download.qt.io/official_releases/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz && \
6+
tar -xf qt-everywhere-src-5.13.2.tar.xz && \
7+
cd qt-everywhere* && \
8+
export MAKEFLAGS=-j$(nproc) && \
9+
./configure -prefix /opt/Qt5.13.2 -release -opensource -confirm-license -qtnamespace QtOpenCVPython -qt-xcb -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \
10+
make && \
11+
make install && \
12+
cd .. && \
13+
rm -rf qt-everywhere-src-5.13.2 && \
14+
rm qt-everywhere-src-5.13.2.tar.xz
15+
16+
ENV QTDIR /opt/Qt5.13.2
17+
ENV PATH "$QTDIR/bin:$PATH"
418

519
RUN mkdir ~/ffmpeg_sources && \
620
cd ~/ffmpeg_sources && \

‎find_version.py‎

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,66 @@
33
importsubprocess
44

55
if__name__=="__main__":
6-
contrib=sys.argv[1]
7-
headless=sys.argv[2]
8-
ci_build=sys.argv[3]
9-
10-
opencv_version=""
11-
# dig out the version from OpenCV sources
12-
version_file_path="opencv/modules/core/include/opencv2/core/version.hpp"
13-
14-
withopen(version_file_path,'r')asf:
15-
forlineinf:
16-
words=line.split()
17-
18-
if"CV_VERSION_MAJOR"inwords:
19-
opencv_version+=words[2]
20-
opencv_version+="."
21-
22-
if"CV_VERSION_MINOR"inwords:
23-
opencv_version+=words[2]
24-
opencv_version+="."
25-
26-
if"CV_VERSION_REVISION"inwords:
27-
opencv_version+=words[2]
28-
break
29-
30-
# used in local dev releases
31-
git_hash=subprocess.check_output(['git','rev-parse','--short','HEAD']).splitlines()[0].decode()
32-
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
33-
try:
34-
tag=subprocess.check_output(['git','describe','--tags'],stderr=subprocess.STDOUT).splitlines()[0].decode().split('-')
35-
exceptsubprocess.CalledProcessErrorase:
36-
# no tags reachable (e.g. on a topic branch in a fork), see
37-
# https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything
38-
ife.output.rstrip()==b"fatal: No names found, cannot describe anything.":
39-
tag=[]
40-
else:
41-
print(e.output);raise
42-
43-
iflen(tag)==1:
44-
# tag identifies the build and should be a sequential revision number
45-
version=tag[0]
46-
opencv_version+=".{}".format(version)
47-
else:
48-
# local version identifier, not to be published on PyPI
49-
version=git_hash
50-
opencv_version+="+{}".format(version)
51-
52-
withopen('cv2/version.py','w')asf:
53-
f.write("opencv_version =\"{}\"\n".format(opencv_version))
54-
f.write("contrib = {}\n".format(contrib))
55-
f.write("headless = {}\n".format(headless))
56-
f.write("ci_build = {}".format(ci_build))
6+
contrib=sys.argv[1]
7+
headless=sys.argv[2]
8+
ci_build=sys.argv[3]
9+
10+
opencv_version=""
11+
# dig out the version from OpenCV sources
12+
version_file_path="opencv/modules/core/include/opencv2/core/version.hpp"
13+
14+
withopen(version_file_path,"r")asf:
15+
forlineinf:
16+
words=line.split()
17+
18+
if"CV_VERSION_MAJOR"inwords:
19+
opencv_version+=words[2]
20+
opencv_version+="."
21+
22+
if"CV_VERSION_MINOR"inwords:
23+
opencv_version+=words[2]
24+
opencv_version+="."
25+
26+
if"CV_VERSION_REVISION"inwords:
27+
opencv_version+=words[2]
28+
break
29+
30+
# used in local dev releases
31+
git_hash= (
32+
subprocess.check_output(["git","rev-parse","--short","HEAD"])
33+
.splitlines()[0]
34+
.decode()
35+
)
36+
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
37+
try:
38+
tag= (
39+
subprocess.check_output(
40+
["git","describe","--tags"],stderr=subprocess.STDOUT
41+
)
42+
.splitlines()[0]
43+
.decode()
44+
.split("-")
45+
)
46+
exceptsubprocess.CalledProcessErrorase:
47+
# no tags reachable (e.g. on a topic branch in a fork), see
48+
# https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything
49+
ife.output.rstrip()==b"fatal: No names found, cannot describe anything.":
50+
tag= []
51+
else:
52+
print(e.output)
53+
raise
54+
55+
iflen(tag)==1:
56+
# tag identifies the build and should be a sequential revision number
57+
version=tag[0]
58+
opencv_version+=".{}".format(version)
59+
else:
60+
# local version identifier, not to be published on PyPI
61+
version=git_hash
62+
opencv_version+="+{}".format(version)
63+
64+
withopen("cv2/version.py","w")asf:
65+
f.write('opencv_version = "{}"\n'.format(opencv_version))
66+
f.write("contrib = {}\n".format(contrib))
67+
f.write("headless = {}\n".format(headless))
68+
f.write("ci_build = {}".format(ci_build))

‎patches/patchQtPlugins‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
diff --git a/opencv/CMakeLists.txt b/opencv/CMakeLists.txt
2-
index8ccad4d03a..0d5e2a79e9 100644
2+
index4c0b3880fc..54da25f151 100644
33
--- a/opencv/CMakeLists.txt
44
+++ b/opencv/CMakeLists.txt
5-
@@ -1164,6 +1164,7 @@ if(WITH_QT OR HAVE_QT)
5+
@@ -1187,6 +1187,12 @@ if(WITH_QT OR HAVE_QT)
66
if(HAVE_QT5)
77
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
88
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
9-
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
9+
+ if(APPLE)
10+
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
11+
+ endif()
12+
+ if(UNIX AND NOT APPLE)
13+
+ install(DIRECTORY /opt/Qt5.13.2/plugins DESTINATION lib/qt)
14+
+ endif()
1015
elseif(HAVE_QT)
1116
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
12-
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
17+
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)

‎setup.py‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,21 @@ def main():
156156
ifsys.platform.startswith("linux")andnotx64and"bdist_wheel"insys.argv:
157157
subprocess.check_call("patch -p0 < patches/patchOpenEXR",shell=True)
158158

159-
# OS-specific components during CIbuilds
159+
# OS-specific components during CIbuild_headless
160160
ifis_CI_build:
161-
ifsys.platform.startswith("linux")andnotbuild_headless:
162-
cmake_args.append("-DWITH_QT=4")
163161

164-
ifsys.platform=="darwin"andnotbuild_headless:
165-
if"bdist_wheel"insys.argv:
166-
cmake_args.append("-DWITH_QT=5")
162+
ifnotbuild_headlessand"bdist_wheel"insys.argv:
163+
cmake_args.append("-DWITH_QT=5")
164+
subprocess.check_call("patch -p1 < patches/patchQtPlugins",shell=True)
165+
166+
ifsys.platform.startswith("linux"):
167+
rearrange_cmake_output_data["cv2.qt.plugins.platforms"]= [
168+
(r"lib/qt/plugins/platforms/libqxcb\.so")
169+
]
170+
ifsys.platform=="darwin":
167171
rearrange_cmake_output_data["cv2.qt.plugins.platforms"]= [
168172
(r"lib/qt/plugins/platforms/libqcocoa\.dylib")
169173
]
170-
subprocess.check_call("patch -p1 < patches/patchQtPlugins",shell=True)
171174

172175
ifsys.platform.startswith("linux"):
173176
cmake_args.append("-DWITH_V4L=ON")

‎tests/test.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ def test_import(self):
1212
deftest_video_capture(self):
1313

1414
importcv2
15+
1516
cap=cv2.VideoCapture("SampleVideo_1280x720_1mb.mp4")
1617
self.assertTrue(cap.isOpened())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp