Skip to content

Commit c5c7ad3

Browse files
committed
* optimize camera doc, update the description of ae and awb mode settings
1 parent b25d31b commit c5c7ad3

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

docs/doc/en/vision/camera.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,20 @@ while 1:
140140

141141
### Set exposure time
142142

143-
Note that after setting the exposure time, the camera will switch to manual exposure mode, if you want to switch back to automatic exposure mode you need to run `cam.exp_mode(0)`.
143+
Note that after setting the exposure time, the camera will switch to manual exposure mode, if you want to switch back to automatic exposure mode you need to run `cam.exp_mode(camera.AeMode.Auto)`.
144144

145145
```python
146+
from maix import camera
146147
cam = camera.Camera()
147148
cam.exposure(1000)
148149
```
149150

150151
### Setting the gain
151152

152-
Note that after setting the gain, the camera will switch to manual exposure mode, to switch back to auto exposure mode you need to run `cam.exp_mode(0)`. Customised gain values will only work in manual exposure mode.
153+
Note that after setting the gain, the camera will switch to manual exposure mode, to switch back to auto exposure mode you need to run `cam.exp_mode(camera.AeMode.Auto)`. Customised gain values will only work in manual exposure mode.
153154

154155
```python
156+
from maix import camera
155157
cam = camera.Camera()
156158
cam.gain(100)
157159
```
@@ -165,15 +167,17 @@ For MaixCam2: [0.0682, 0, 0, 0.04897]
165167
To fine-tune image appearance, it is usually sufficient to adjust only the `R` and `B` channels, while keeping `Gr` and `Gb` unchanged.
166168

167169
```python
170+
from maix import camera
168171
cam = camera.Camera()
169-
cam.awb_mode(1) # 0 to enable auto white balance, 1 to enable manual white balance
172+
cam.awb_mode(camera.AwbMode.Manual) # AwbMode.Manual to enable auto white balance, AwbMode.Manual to enable manual white balance
170173
cam.set_wb_gain([0.134, 0.0625, 0.0625, 0.1239]) # Set gains for R, Gr, Gb, B channels
171174

172175
```
173176

174177
### Setting brightness, contrast and saturation
175178

176179
```python
180+
from maix import camera
177181
cam = camera.Camera()
178182
cam.luma(50) # Set brightness, range [0, 100]
179183
cam.constrast(50) # set contrast, range [0, 100]
@@ -185,6 +189,7 @@ cam.saturation(50) # Set the saturation, range [0, 100].
185189
Note that the output `raw` image is the original `Bayer` image, and the format of the `Bayer` image may vary depending on the camera module.
186190

187191
```python
192+
from maix import camera
188193
cam = camera.Camera(raw=true)
189194
raw_img = cam.read_raw()
190195
print(raw_img)

docs/doc/zh/vision/camera.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,20 @@ while 1:
154154

155155
### 设置曝光时间
156156

157-
注意设置曝光时间后,摄像头会切换到手动曝光模式,如果要切换回自动曝光模式需运行`cam.exp_mode(0)`
157+
注意设置曝光时间后,摄像头会切换到手动曝光模式,如果要切换回自动曝光模式需运行`cam.exp_mode(camera.AeMode.Auto)`
158158

159159
```python
160+
from maix import camera
160161
cam = camera.Camera()
161162
cam.exposure(1000)
162163
```
163164

164165
### 设置增益
165166

166-
注意设置增益后,摄像头会切换到手动曝光模式,如果要切换回自动曝光模式需运行`cam.exp_mode(0)`。自定义的增益值只能在手动曝光模式下生效。
167+
注意设置增益后,摄像头会切换到手动曝光模式,如果要切换回自动曝光模式需运行`cam.exp_mode(camera.AeMode.Auto)`。自定义的增益值只能在手动曝光模式下生效。
167168

168169
```python
170+
from maix import camera
169171
cam = camera.Camera()
170172
cam.gain(100)
171173
```
@@ -176,14 +178,16 @@ cam.gain(100)
176178
如果需要调整画面效果, 通常只需要调整`R`通道和`B`通道, `Gr``Gb`通道可以保持不变
177179

178180
```python
181+
from maix import camera
179182
cam = camera.Camera()
180-
cam.awb_mode(1) # 0,开启自动白平衡, 1,开启手动白平衡;
183+
cam.awb_mode(camera.AwbMode.Manual) # AwbMode.Auto,开启自动白平衡, AwbMode.Manual,开启手动白平衡;
181184
cam.set_wb_gain([0.134, 0.0625, 0.0625, 0.1239]) # 设置r, gr, gb, b四个通道的增益
182185
```
183186

184187
### 设置亮度、对比度和饱和度
185188

186189
```python
190+
from maix import camera
187191
cam = camera.Camera()
188192
cam.luma(50) # 设置亮度,范围[0, 100]
189193
cam.constrast(50) # 设置对比度,范围[0, 100]
@@ -192,11 +196,13 @@ cam.saturation(50) # 设置饱和度,范围[0, 100]
192196
### 更改图片长宽
193197

194198
```python
199+
from maix import camera
195200
cam = camera.Camera(width=640, height=480)
196201
```
197202
198203

199204
```python
205+
from maix import camera
200206
cam = camera.Camera()
201207
cam.set_resolution(width=640, height=480)
202208
```
@@ -206,6 +212,7 @@ cam.set_resolution(width=640, height=480)
206212
注意输出的`raw`图是原始的`bayer`图,并且不同摄像头模组输出的`bayer`图格式可能不一样。
207213

208214
```python
215+
from maix import camera
209216
cam = camera.Camera(raw=true)
210217
raw_img = cam.read_raw()
211218
print(raw_img)

0 commit comments

Comments
 (0)