You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Large code reorganisation, addition of tests (see below)
Files are moved into a number of new subdirectories.
A Picamera2.start_preview function has been added in place of direct
preview object creation.
A "tests" folder added with some initial tests.
All the examples are updated.
Scripts added for style checking and running tests.
Copy file name to clipboardExpand all lines: README.md
+40-13
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ For the time being, the documentation here is mostly based on a number of suppli
10
10
11
11
## Installation
12
12
13
-
These instructions are for a fresh 32-bit Bullseye image running on a Pi 4B. On other platforms your mileage may vary - good luck. Note that I found OpenCV more of a pain to install on a 64-bit image, but you may know better incantations than I do (please share!).
13
+
These instructions are for a fresh 32-bit Bullseye image running on a Pi 4B. On other platforms your mileage may vary - good luck.
14
14
15
15
First install and build *libcamera* according to the [standard instructions](https://www.raspberrypi.com/documentation/accessories/camera.html#building-libcamera) but with the following *two* differences:
16
16
@@ -55,16 +55,35 @@ To make everything run, you will also have to set your `PYTHONPATH` environment
I had some difficulties installing the latest version, and the version from apt didn't seem to include the Haar classifiers. But the following appears to work:
60
+
OpenCV can be installed from `apt` as follows. Normally this should avoid the very long build times that can sometimes be required by other methods.
61
61
62
62
```
63
-
sudo pip3 install opencv-python==4.4.0.46
64
-
sudo apt install -y libatlas-base-dev
65
-
sudo pip3 install numpy --upgrade
63
+
sudo apt install -y python3-opencv
64
+
sudo apt install -y opencv-data
66
65
```
67
66
67
+
## Contributing
68
+
69
+
We are happy to receive pull requests that will fix bugs, add features and generally improve the code. If possible, pull requests would ideally be:
70
+
71
+
- Restricted to one change or feature each.
72
+
- The commit history should consist of a number of commits that are as easy to review as possible.
73
+
- Where changes are likely to be more involved, we would invite authors to start a discussion with us first so that we can agree a good way forward.
74
+
- All the tests and examples should be working after each commit in the pull request. We'll shortly be adding some automated testing to the repository to make it easier to test if things have become broken.
75
+
- Any documentation should be updated accordingly. Where appropriate, new examples and tests would be welcomed.
76
+
- The author of the pull request needs to agree that they are donating the work to this project and to Raspberry Pi Ltd., so that we can continue to distribute it as open source to all our users. To indicate your agreement to this, we would ask that you finish commit messages with a blank line followed by `Signed-off-by: Your Name <your.email@your.domain>`.
77
+
- We'd like to conform to the common Python _PEP 8_ coding style wherever possible. To facilitate this we would recommend putting
Readers are recommended to refer to the supplied [examples](#examples) in conjunction with the descriptions below.
@@ -74,7 +93,7 @@ Readers are recommended to refer to the supplied [examples](#examples) in conjun
74
93
The camera system should be opened as shown.
75
94
76
95
```
77
-
from picamera2 import *
96
+
from picamera2.picamera2 import *
78
97
79
98
picam2 = Picamera2()
80
99
```
@@ -157,26 +176,34 @@ The *Picamera2* class implements most of the camera functionality, however, it d
157
176
- Use the `NullPreview` class. This class actually generates no preview window at all and merely supplies an event loop that drives the camera.
158
177
- In a Qt application, the `QPicamer2` or `QGlPicamera2` widgets are provided and automatically use the Qt event loop to drive the camera.
159
178
160
-
In all cases creating one of these objects starts the event loop, though it will not receive any frames until `Picamera2.start` is called.
179
+
To start the event loop, the `start_preview` method should be called. It can be passed an actual preview object, or for convenience can be passed one of the Preview enum values (see below). If given no arguments at all, a `NullPreview` is created. When running under a Qt even loop, `start_preview` should _not_ be called at all.
161
180
162
181
Example:
163
182
164
183
```
165
-
from picamera2 import *
166
-
from qt_gl_preview import *
184
+
from picamera2.picamera2 import *
167
185
168
186
picam2 = Picamera2()
169
-
preview = QtGlPreview(picam2)
187
+
picam2.start_preview(Preview.QTGL)
170
188
171
189
config = picam2.preview_configuration()
172
190
picam2.configure(config)
173
191
174
192
picam2.start()
175
193
```
176
194
177
-
To use the DRM preview window, use `from drm_preview import *` and `preview = DrmPreview(picam2)` instead.
195
+
Note that
196
+
```
197
+
from picamera2.previews.qt_gl_preview import *
198
+
picam2.start_preview(QtGlPreview())
199
+
```
200
+
is equivalent to `picam2.start_preview(Preview.QTGL)`.
201
+
202
+
To use the DRM preview window, use `picam2.start_preview(Preview.DRM)` instead.
203
+
204
+
To use the Qt (non-GL) preview window, use `picam2.start_preview(Preview.QT)` instead.
178
205
179
-
For no preview window at all, use `from null_preview import *` and `preview = NullPreview(picam2)` instead.
206
+
For no preview window at all, use `picam2.start_preview()` or `picam2.start_preview(Preview.NULL)`.
180
207
181
208
Please refer to the supplied examples for more information.
0 commit comments