Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit d2a4f95

Browse files
committed
Update README
1 parent 26ec26d commit d2a4f95

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
1-
### mciantyre/scipy-opencv-notebook Docker image
1+
## mciantyre/scipy-opencv-notebook Docker image
22

33
All the fun of the [jupyter/scipy-notebook][jupyter-scipy-nb] Docker image, plus OpenCV 3.0.0, Python 3 bindings, and the OpenCV extra modules. Check out the [jupyter/scipy-notebook][jupyter-scipy-nb] for more information.
44

55
Note: OpenCV was built with only Python 3 bindings. Therefore, Python 2 notebooks cannot `import cv2`.
66

7-
#### Doesn't this exist?
7+
## Getting started
8+
9+
```
10+
docker pull mciantyre/scipy-opencv-notebook
11+
docker run -d -p 8888:8888 mciantyre/scipy-opencv-notebook
12+
```
13+
14+
See [jupyter/scipy-notebook][jupyter-scipy-nb] for optional `run` arguments.
15+
16+
Navigate to `localhost:8888` in any browser, and make your first Python 3 notebook! Here's a script to find a face in a picture that you upload:
17+
18+
```python
19+
%matplotlib inline
20+
import numpy as np
21+
import matplotlib.pyplot as plt
22+
import cv2
23+
24+
img = cv2.imread("your_uploaded_image.jpg")
25+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
26+
plt.imshow(img) # shows face without box
27+
28+
# If you need to find directories of data files,
29+
# open up a terminal window from the web interface and search from there
30+
# find /opt -iname *haar*
31+
face_cascade = cv2.CascadeClassifier('/opt/opencv/data/haarcascades/haarcascade_frontalface_default.xml')
32+
33+
faces = face_cascade.detectMultiScale(img, 1.3, 5)
34+
for (x,y,w,h) in faces:
35+
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
36+
roi = img[y:y+h, x:x+w]
37+
38+
plt.imshow(img) # shows the face with a box around it
39+
```
40+
41+
### Doesn't this exist?
842

943
In a few places! But, I wanted to make my own for practice.
1044

11-
Thanks to the [jupyter/docker-stacks][jupyter-stacks] project, OpenCV, and Docker. Made for the University of Pittsburgh DesignHub.
45+
Thanks to the [jupyter/docker-stacks][jupyter-stacks] project and the Jupyter team, OpenCV, and Docker. Made for the University of Pittsburgh DesignHub.
1246

1347
[jupyter-scipy-nb]: https://github.com/jupyter/docker-stacks/tree/master/scipy-notebook
1448
[jupyter-stacks]: https://github.com/jupyter/docker-stacks

0 commit comments

Comments
 (0)