Skip to content

Commit b5f98ea

Browse files
Merge branch 'master' into feature/add_stage_4.1
2 parents 4cd973d + 54b87f9 commit b5f98ea

34 files changed

+449
-7
lines changed

.github/workflows/flake8.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Flake8
2+
3+
on:
4+
pull_request
5+
6+
jobs:
7+
flake8:
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: ['3.6']
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install flake8
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install flake8
25+
- name: Run flake8
26+
run: |
27+
python -m flake8

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ scalable applications, and package them into an installer.
2020
### Requirements
2121

2222
- Python 3.6+
23+
- scikits.image
24+
- Pillow
2325
- Pandas
2426
- matplotlib
2527
- traits
2628
- traitsui
27-
- scikits.image
2829

2930
### EDM users (recommended)
3031
First, download and install EDM from https://www.enthought.com/edm/. Then, run
@@ -33,7 +34,7 @@ Python environment and install all dependencies in it:
3334
```commandline
3435
edm env create ets_tutorial
3536
edm shell -e ets_tutorial
36-
edm install pandas matplotlib traits traitsui scikits.image
37+
edm install pandas matplotlib traits traitsui scikits.image pillow pyqt5 ipython
3738
```
3839

3940
### Conda users
@@ -43,14 +44,15 @@ edm install pandas matplotlib traits traitsui scikits.image
4344
Assuming a Python environment is created and activated on your machine, for
4445
example from https://www.python.org/,
4546
```commandline
46-
pip install pandas matplotlib traits traitsui scikits-image
47+
pip install pandas matplotlib traits traitsui scikits-image pillow pyqt5 ipython
4748
```
4849

4950
## Getting help
5051
### During the tutorial
5152
During the tutorial, don't hesitate to ask for help:
5253
- ask questions if something isn't clear,
53-
- there will be a number of developers in the room who can help unblock you.
54+
- or just call out for individual support: there will be a number of developers
55+
in the room who can help unblock you.
5456

5557
### After the tutorial
5658
- This tutorial was recorded and can be watched [here]() [TODO]
80.3 KB
Loading

sample_images/owls.jpg

3.07 MB
Loading

stage0_starting_script/face_detect_skimage.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1+
""" Script analyzing an image, detecting human faces inside it, and printing
2+
EXIF data about it.
3+
"""
4+
import PIL.Image
5+
from PIL.ExifTags import TAGS
16
from skimage import data
27
from skimage.feature import Cascade
3-
48
import matplotlib.pyplot as plt
59
from matplotlib import patches
10+
import sys
11+
from os.path import join
612

713
# Load the trained file from the module root.
814
trained_file = data.lbp_frontal_face_cascade_filename()
915

1016
# Initialize the detector cascade.
1117
detector = Cascade(trained_file)
1218

13-
img = data.astronaut()
19+
if len(sys.argv) > 1:
20+
image_path = sys.argv[1]
21+
else:
22+
image_path = join("..", "sample_images", "IMG-0311_xmas_2020.JPG")
23+
# image_path = join("..", "sample_images", "owls.jpg")
24+
25+
img = plt.imread(image_path)
1426

1527
detected = detector.detect_multi_scale(img=img,
1628
scale_factor=1.2,
1729
step_ratio=1,
1830
min_size=(60, 60),
19-
max_size=(123, 123))
31+
max_size=(600, 600))
2032

2133
plt.imshow(img)
2234
img_desc = plt.gca()
@@ -35,4 +47,11 @@
3547
)
3648
)
3749

50+
img = PIL.Image.open(image_path)
51+
52+
data = {TAGS[k]: v for k, v in img._getexif().items() if k in TAGS}
53+
data["Number of faces detected"] = len(detected)
54+
55+
print(data)
56+
3857
plt.show()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Hello world in ETS pyface!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
__version__ = "0.0.1"

stage4.0_first_application/pycasa/app/__init__.py

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# coding=utf-8
2+
""" TaskApplication object for the Pycasa app.
3+
"""
4+
import logging
5+
6+
from pyface.tasks.api import TasksApplication, TaskFactory
7+
from ..ui.tasks.hello_world_task import HelloWorldTask
8+
9+
logger = logging.getLogger(__name__)
10+
11+
12+
class PycasaApplication(TasksApplication):
13+
""" An application to say hello.
14+
"""
15+
id = "pycasa_application"
16+
17+
name = "Pycasa"
18+
19+
description = "An example Tasks application that explores image files."
20+
21+
def _task_factories_default(self):
22+
return [
23+
TaskFactory(
24+
id='pycasa.hello_world_task',
25+
name="Hello World Editor",
26+
factory=HelloWorldTask
27+
)
28+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
from pycasa.app.app import PycasaApplication
3+
4+
5+
def main():
6+
app = PycasaApplication()
7+
app.run()
8+
9+
10+
if __name__ == '__main__':
11+
main()

0 commit comments

Comments
 (0)