Skip to content

Commit e9faf24

Browse files
committed
Merge branch 'release/2019.0910'
2 parents 74fcaeb + bf26bb2 commit e9faf24

File tree

16 files changed

+42
-153
lines changed

16 files changed

+42
-153
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ venv/
44
.buildozer/
55
.pytest_cache/
66
.tox/
7-
opencv-*

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ venv/
55
.tox/
66
.buildozer/
77
bin/
8-
opencv-*
98
build/
109
dist/
1110
*.egg-info/

CHANGELOG.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [2019.0910]
4+
5+
- Use new `xcamera` from PyPI
6+
- Use `opencv-python` from PyPI, refs #23
7+
38
## [2019.0909]
49

510
- Fix camera events not binded
@@ -22,7 +27,7 @@
2227
- Publish documentation to readthedocs, refs #18
2328
- Publish to PyPI, refs #19
2429

25-
## [20190303]
30+
## [2019.0303]
2631

2732
- Add Python3.6 support, refs #5
2833
- Fully migrated Android from PIL to Pillow, refs #13
@@ -31,12 +36,12 @@
3136
- Migrate from zbarlight to pyzbar, refs #32
3237
- Migrate to Python3.6 and opencv 4, refs #33
3338

34-
## [20190223]
39+
## [2019.0223]
3540

3641
- Fix zbarlight dependency in setup.py, refs #28
3742
- Migrate to zbarlight 2.1, refs #18
3843

39-
## [20190222]
44+
## [2019.0222]
4045

4146
- Provide Makefile, refs #15
4247
- Setup continuous integration testing, refs #6, #14
@@ -46,31 +51,31 @@
4651
- Using non-root Docker container, refs #27
4752
- Run UI tests from Travis, refs #26
4853

49-
## [20171220]
54+
## [2017.1220]
5055

5156
- Full screen camera
5257
- Kvlang refactoring
5358
- File tree refactoring
5459

55-
## [20171117]
60+
## [2017.1117]
5661

5762
- Integrated to kivy-garden
5863

59-
## [20171102]
64+
## [2017.1102]
6065

6166
- Add camera start/stop
6267

63-
## [20171020]
68+
## [2017.1020]
6469

6570
- Add Android autofocus, refs #2
6671
- Fix Android rotation, refs #3
6772
- Add animated demo gif
6873

69-
## [20171019]
74+
## [2017.1019]
7075

7176
- Add ZBar Android support, refs #1
7277
- Add PIL/Pillow Android workaround
7378

74-
## [20171016]
79+
## [2017.1016]
7580

7681
- Initial release

Makefile

Lines changed: 13 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -11,106 +11,35 @@ SOURCES=src/ tests/ setup.py setup_meta.py
1111
SPHINXBUILD=$(shell realpath venv/bin/sphinx-build)
1212
DOCS_DIR=doc
1313
SYSTEM_DEPENDENCIES= \
14-
build-essential \
15-
cmake \
16-
curl \
1714
libpython$(PYTHON_VERSION)-dev \
1815
libsdl2-dev \
1916
libzbar-dev \
2017
tox \
21-
virtualenv \
22-
wget
18+
virtualenv
2319
OS=$(shell lsb_release -si)
2420
PYTHON_MAJOR_VERSION=3
2521
PYTHON_MINOR_VERSION=6
2622
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
2723
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
28-
# python3 has a "m" suffix for both include path and library
29-
PYTHON_M=$(PYTHON_WITH_VERSION)
30-
SITE_PACKAGES_DIR=$(VENV_NAME)/lib/$(PYTHON_WITH_VERSION)/site-packages
31-
TMPDIR ?= /tmp
32-
DOWNLOAD_DIR = $(TMPDIR)/downloads
33-
OPENCV_VERSION=4.0.1
34-
OPENCV_BASENAME=opencv-$(OPENCV_VERSION)
35-
OPENCV_ARCHIVE=$(OPENCV_BASENAME).tar.gz
36-
OPENCV_ARCHIVE_PATH=$(DOWNLOAD_DIR)/$(OPENCV_ARCHIVE)
37-
OPENCV_EXTRACT_PATH=$(DOWNLOAD_DIR)/$(OPENCV_BASENAME)
38-
OPENCV_BUILD_LIB_DIR=$(OPENCV_EXTRACT_PATH)/build/lib
39-
OPENCV_BUILD=$(OPENCV_BUILD_LIB_DIR)/python$(PYTHON_MAJOR_VERSION)/cv2*.so
40-
OPENCV_DEPLOY=$(SITE_PACKAGES_DIR)/cv2*.so
41-
NPROC=`grep -c '^processor' /proc/cpuinfo`
42-
43-
44-
ifeq ($(PYTHON_MAJOR_VERSION), 3)
45-
PYTHON_M := $(PYTHON_M)m
46-
endif
4724

4825

49-
all: system_dependencies virtualenv opencv
26+
all: system_dependencies virtualenv
5027

5128
venv:
52-
test -d venv || virtualenv -p python$(PYTHON_MAJOR_VERSION) venv
29+
test -d venv || virtualenv -p $(PYTHON_WITH_VERSION) venv
5330

5431
virtualenv: venv
5532
$(PIP) install Cython==0.28.6
5633
$(PIP) install -r requirements/requirements.txt
57-
$(GARDEN) install xcamera
34+
35+
virtualenv/test: virtualenv
36+
$(PIP) install -r requirements/requirements-test.txt
5837

5938
system_dependencies:
6039
ifeq ($(OS), Ubuntu)
6140
sudo apt install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES)
6241
endif
6342

64-
$(OPENCV_ARCHIVE_PATH):
65-
mkdir -p $(DOWNLOAD_DIR)
66-
curl --location https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz \
67-
--progress-bar --output $(OPENCV_ARCHIVE_PATH)
68-
69-
# The build also relies on virtualenv, because we make references to it.
70-
# Plus numpy is required to build OpenCV Python module.
71-
$(OPENCV_BUILD): $(OPENCV_ARCHIVE_PATH) virtualenv
72-
tar -xf $(OPENCV_ARCHIVE_PATH) --directory $(DOWNLOAD_DIR)
73-
cmake \
74-
-D CMAKE_SHARED_LINKER_FLAGS=-l$(PYTHON_M) \
75-
-D BUILD_SHARED_LIBS=ON \
76-
-D BUILD_STATIC_LIBS=OFF \
77-
-D BUILD_DOCS=OFF \
78-
-D BUILD_OPENCV_APPS=OFF \
79-
-D BUILD_OPENCV_JAVA=OFF \
80-
-D BUILD_OPENCV_JAVA_BINDINGS_GENERATOR=OFF \
81-
-D BUILD_OPENCV_NONFREE=OFF \
82-
-D BUILD_OPENCV_PYTHON2=OFF \
83-
-D BUILD_OPENCV_PYTHON3=ON \
84-
-D BUILD_OPENCV_STITCHING=OFF \
85-
-D BUILD_OPENCV_SUPERRES=OFF \
86-
-D BUILD_OPENCV_TS=OFF \
87-
-D BUILD_PACKAGE=OFF \
88-
-D BUILD_PERF_TESTS=OFF \
89-
-D BUILD_TESTS=OFF \
90-
-D BUILD_WITH_DEBUG_INFO=OFF \
91-
-D OPENCV_SKIP_PYTHON_LOADER=ON \
92-
-D OPENCV_PYTHON$(PYTHON_MAJOR_VERSION)_INSTALL_PATH=$(SITE_PACKAGES_DIR) \
93-
-D PYTHON$(PYTHON_MAJOR_VERSION)_PACKAGES_PATH=$(SITE_PACKAGES_DIR) \
94-
-D PYTHON$(PYTHON_MAJOR_VERSION)_EXECUTABLE=$(PYTHON) \
95-
-D PYTHON$(PYTHON_MAJOR_VERSION)_INCLUDE_PATH=/usr/include/$(PYTHON_M)/ \
96-
-D PYTHON$(PYTHON_MAJOR_VERSION)_LIBRARIES=/usr/lib/x86_64-linux-gnu/lib$(PYTHON_M).so \
97-
-D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python$(PYTHON_MAJOR_VERSION) \
98-
-D WITH_1394=OFF \
99-
-D WITH_CUDA=OFF \
100-
-D WITH_CUFFT=OFF \
101-
-D WITH_GIGEAPI=OFF \
102-
-D WITH_GTK=OFF \
103-
-D WITH_JASPER=OFF \
104-
-D WITH_OPENEXR=OFF \
105-
-D WITH_PVAPI=OFF \
106-
-B$(OPENCV_EXTRACT_PATH)/build -H$(OPENCV_EXTRACT_PATH)
107-
cmake --build $(OPENCV_EXTRACT_PATH)/build -- -j$(NPROC)
108-
109-
$(OPENCV_DEPLOY): $(OPENCV_BUILD) virtualenv
110-
cp $(OPENCV_BUILD) $(SITE_PACKAGES_DIR)
111-
112-
opencv: $(OPENCV_DEPLOY)
113-
11443
run/linux: virtualenv
11544
$(PYTHON) src/main.py
11645

@@ -119,20 +48,19 @@ run: run/linux
11948
test:
12049
$(TOX)
12150

122-
uitest: virtualenv
123-
$(PIP) install -r requirements/test_requirements.txt
51+
uitest: virtualenv/test
12452
PYTHONPATH=src $(PYTHON) -m unittest discover --top-level-directory=. --start-directory=tests/ui/
12553

126-
isort-check: virtualenv
54+
lint/isort-check: virtualenv/test
12755
$(ISORT) --check-only --recursive --diff $(SOURCES)
12856

129-
isort-fix: virtualenv
57+
lint/isort-fix: virtualenv/test
13058
$(ISORT) --recursive $(SOURCES)
13159

132-
flake8: virtualenv
60+
lint/flake8: virtualenv/test
13361
$(FLAKE8) $(SOURCES)
13462

135-
lint: isort-check flake8
63+
lint: lint/isort-check lint/flake8
13664

13765
docs/clean:
13866
rm -rf $(DOCS_DIR)/build/
@@ -156,5 +84,5 @@ clean: release/clean docs/clean
15684
find src/ -type d -name "__pycache__" -exec rm -r {} +
15785
find src/ -type d -name "*.egg-info" -exec rm -r {} +
15886

159-
clean/full: clean
160-
rm -rf $(VENV_NAME) .tox/ $(DOWNLOAD_DIR)
87+
clean/all: clean
88+
rm -rf $(VENV_NAME) .tox/

OpenCV.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ Install system requirements (Ubuntu 18.04):
3535
make system_dependencies
3636
```
3737

38-
Install garden requirements:
39-
```sh
40-
garden install --upgrade xcamera
41-
```
42-
4338
Install zbarcam:
4439
```sh
4540
pip install --upgrade zbarcam
@@ -49,11 +44,6 @@ Then import it in your Python code via:
4944
from kivy_garden.zbarcam import ZBarCam
5045
```
5146

52-
[OpenCV](OpenCV.md):
53-
```sh
54-
make opencv
55-
```
56-
5747
### Android
5848
Build for Android via buildozer, see [buildozer.spec](buildozer.spec).
5949

@@ -70,16 +60,7 @@ make uitest
7060

7161
## Troubleshooting
7262

73-
### Install `Unable to import package 'kivy.garden.xcamera.XCamera'`
74-
You're missing the `xcamera` dependency. Install it as described in the install instructions.
75-
7663
### Android `ValueError: Empty module name`
7764
More likely an import issue in your `.kv` file.
7865
Try to `from zbarcam import ZBarCam` in your `main.py` to see the exact error.
7966
It's common to forget `Pillow` in `buildozer.spec` `requirements` section.
80-
81-
### OpenCV related
82-
See [OpenCV.md](OpenCV.md).
83-
84-
## Credits
85-
I borrowed a lot of code from [tito/android-zbar-qrcode](https://github.com/tito/android-zbar-qrcode).

buildozer.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ requirements =
4343
libzbar,
4444
Pillow==5.2.0,
4545
python3,
46-
pyzbar==0.1.8
46+
pyzbar==0.1.8,
47+
xcamera
4748
4849
4950
# (str) Custom source folders for requirements
@@ -52,7 +53,6 @@ requirements =
5253
5354
# (list) Garden requirements
5455
#garden_requirements =
55-
garden_requirements = xcamera
5656
5757
# (str) Presplash of the application
5858
#presplash.filename = %(source.dir)s/data/presplash.png
File renamed without changes.

requirements/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Kivy==1.11.1
22
Kivy-Garden==0.1.4
33
numpy==1.16.1
4+
opencv-python==4.1.1.26
45
Pillow==5.2.0
56
pyzbar==0.1.8
7+
xcamera

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ def read(fname):
2525
'install_requires': [
2626
'kivy',
2727
'numpy',
28+
'opencv-python>=4',
2829
'pillow',
2930
'pyzbar',
31+
'xcamera',
3032
],
3133
}
3234

0 commit comments

Comments
 (0)