|
| 1 | +from __future__ import annotations |
| 2 | +from typing import Final |
| 3 | + |
| 4 | +class GainCeiling(): |
| 5 | + X2: Final[int] = 0 # 2X gain |
| 6 | + X4: Final[int] = 1 # 4X gain |
| 7 | + X8: Final[int] = 2 # 8X gain |
| 8 | + X16: Final[int] = 3 # 16X gain |
| 9 | + X32: Final[int] = 4 # 32X gain |
| 10 | + X64: Final[int] = 5 # 64X gain |
| 11 | + X128: Final[int] = 6 # 128X gain |
| 12 | + def __init__(self, *argv, **kwargs) -> None: |
| 13 | + ... |
| 14 | + |
| 15 | + |
| 16 | +class GrabMode(): |
| 17 | + WHEN_EMPTY: Final[int] = 0 |
| 18 | + LATEST: Final[int] = 1 |
| 19 | + def __init__(self, *argv, **kwargs) -> None: |
| 20 | + ... |
| 21 | + |
| 22 | + |
| 23 | +class PixelFormat(): |
| 24 | + RGB555: Final[int] = 8 |
| 25 | + RGB565: Final[int] = 0 |
| 26 | + RGB888: Final[int] = 5 |
| 27 | + YUV420: Final[int] = 2 |
| 28 | + YUV422: Final[int] = 1 |
| 29 | + RGB444: Final[int] = 7 |
| 30 | + GRAYSCALE: Final[int] = 3 |
| 31 | + JPEG: Final[int] = 4 |
| 32 | + RAW: Final[int] = 6 |
| 33 | + def __init__(self, *argv, **kwargs) -> None: |
| 34 | + ... |
| 35 | + |
| 36 | + |
| 37 | +class FrameSize(): |
| 38 | + R240X240: Final[int] = 5 |
| 39 | + XGA: Final[int] = 12 |
| 40 | + R320X320: Final[int] = 7 |
| 41 | + QVGA: Final[int] = 6 |
| 42 | + R128x128: int = 2 |
| 43 | + QXGA: Final[int] = 19 |
| 44 | + VGA: Final[int] = 10 |
| 45 | + R96X96: Final[int] = 0 |
| 46 | + WQXGA: Final[int] = 21 |
| 47 | + SVGA: Final[int] = 11 |
| 48 | + UXGA: Final[int] = 15 |
| 49 | + SXGA: Final[int] = 14 |
| 50 | + HQVGA: Final[int] = 4 |
| 51 | + QSXGA: Final[int] = 23 |
| 52 | + HVGA: Final[int] = 9 |
| 53 | + CIF: Final[int] = 8 |
| 54 | + HD: Final[int] = 13 |
| 55 | + FHD: Final[int] = 16 |
| 56 | + QHD: Final[int] = 20 |
| 57 | + P_3MP: Final[int] = 18 |
| 58 | + QQVGA: Final[int] = 1 |
| 59 | + P_FHD: Final[int] = 22 |
| 60 | + QCIF: Final[int] = 3 |
| 61 | + P_HD: Final[int] = 17 |
| 62 | + def __init__(self, *argv, **kwargs) -> None: |
| 63 | + ... |
| 64 | + |
| 65 | + |
| 66 | +class Camera(): |
| 67 | + def __init__(self, *, |
| 68 | + data_pins: list[int] | None = None, |
| 69 | + pclk_pin: int | None = None, |
| 70 | + vsync_pin: int | None = None, |
| 71 | + href_pin: int | None = None, |
| 72 | + sda_pin: int | None = None, |
| 73 | + scl_pin: int | None = None, |
| 74 | + xclk_pin: int | None = None, |
| 75 | + xclk_freq: int = 20000000, |
| 76 | + powerdown_pin: int = -1, |
| 77 | + reset_pin: int = -1, |
| 78 | + pixel_format: int = PixelFormat.RGB565, |
| 79 | + frame_size: int = FrameSize.QVGA, |
| 80 | + jpeg_quality: int = 85, |
| 81 | + fb_count: int = 1, |
| 82 | + grab_mode: int = GrabMode.WHEN_EMPTY, |
| 83 | + init: bool = True) -> None: |
| 84 | + ... |
| 85 | + |
| 86 | + def get_special_effect(self) -> int: |
| 87 | + """Get the current special effect setting.""" |
| 88 | + ... |
| 89 | + |
| 90 | + def set_special_effect(self, value: int) -> None: |
| 91 | + """Set the special effect.""" |
| 92 | + ... |
| 93 | + |
| 94 | + def set_awb_gain(self, value: bool) -> None: |
| 95 | + """Enable/disable Auto White Balance Gain.""" |
| 96 | + ... |
| 97 | + |
| 98 | + def get_awb_gain(self) -> bool: |
| 99 | + """Get Auto White Balance Gain state.""" |
| 100 | + ... |
| 101 | + |
| 102 | + def set_agc_gain(self, value: int) -> None: |
| 103 | + """Set the Auto Gain Control gain value.""" |
| 104 | + ... |
| 105 | + |
| 106 | + def get_agc_gain(self) -> int: |
| 107 | + """Get the Auto Gain Control gain value.""" |
| 108 | + ... |
| 109 | + |
| 110 | + def set_aec_value(self, value: int) -> None: |
| 111 | + """Set the Auto Exposure Control value.""" |
| 112 | + ... |
| 113 | + |
| 114 | + def get_aec_value(self) -> int: |
| 115 | + """Get the Auto Exposure Control value.""" |
| 116 | + ... |
| 117 | + |
| 118 | + def set_bpc(self, value: bool) -> None: |
| 119 | + """Enable/disable Bad Pixel Correction.""" |
| 120 | + ... |
| 121 | + |
| 122 | + def get_bpc(self) -> bool: |
| 123 | + """Get Bad Pixel Correction state.""" |
| 124 | + ... |
| 125 | + |
| 126 | + def set_contrast(self, value: int) -> None: |
| 127 | + """Set the contrast level (-2 to 2).""" |
| 128 | + ... |
| 129 | + |
| 130 | + def get_contrast(self) -> int: |
| 131 | + """Get the contrast level.""" |
| 132 | + ... |
| 133 | + |
| 134 | + def set_colorbar(self, value: bool) -> None: |
| 135 | + """Enable/disable color bar test pattern.""" |
| 136 | + ... |
| 137 | + |
| 138 | + def get_colorbar(self) -> bool: |
| 139 | + """Get color bar test pattern state.""" |
| 140 | + ... |
| 141 | + |
| 142 | + def set_brightness(self, value: int) -> None: |
| 143 | + """Set the brightness level (-2 to 2).""" |
| 144 | + ... |
| 145 | + |
| 146 | + def get_brightness(self) -> int: |
| 147 | + """Get the brightness level.""" |
| 148 | + ... |
| 149 | + |
| 150 | + def set_aec2(self, value: bool) -> None: |
| 151 | + """Enable/disable AEC DSP.""" |
| 152 | + ... |
| 153 | + |
| 154 | + def get_aec2(self) -> bool: |
| 155 | + """Get AEC DSP state.""" |
| 156 | + ... |
| 157 | + |
| 158 | + def set_whitebal(self, value: bool) -> None: |
| 159 | + """Enable/disable white balance.""" |
| 160 | + ... |
| 161 | + |
| 162 | + def get_whitebal(self) -> bool: |
| 163 | + """Get white balance state.""" |
| 164 | + ... |
| 165 | + |
| 166 | + def set_wb_mode(self, value: int) -> None: |
| 167 | + """Set white balance mode.""" |
| 168 | + ... |
| 169 | + |
| 170 | + def get_wb_mode(self) -> int: |
| 171 | + """Get white balance mode.""" |
| 172 | + ... |
| 173 | + |
| 174 | + def set_vflip(self, value: bool) -> None: |
| 175 | + """Enable/disable vertical flip.""" |
| 176 | + ... |
| 177 | + |
| 178 | + def get_vflip(self) -> bool: |
| 179 | + """Get vertical flip state.""" |
| 180 | + ... |
| 181 | + |
| 182 | + def set_wpc(self, value: bool) -> None: |
| 183 | + """Enable/disable White Pixel Correction.""" |
| 184 | + ... |
| 185 | + |
| 186 | + def get_wpc(self) -> bool: |
| 187 | + """Get White Pixel Correction state.""" |
| 188 | + ... |
| 189 | + |
| 190 | + def set_ae_level(self, value: int) -> None: |
| 191 | + """Set Auto Exposure level (-2 to 2).""" |
| 192 | + ... |
| 193 | + |
| 194 | + def get_ae_level(self) -> int: |
| 195 | + """Get Auto Exposure level.""" |
| 196 | + ... |
| 197 | + |
| 198 | + def reconfigure(self, *, frame_size: int | None = None, |
| 199 | + pixel_format: int | None = None, |
| 200 | + grab_mode: int | None = None, |
| 201 | + fb_count: int | None = None) -> None: |
| 202 | + """Reconfigure camera with new settings.""" |
| 203 | + ... |
| 204 | + |
| 205 | + def init(self) -> None: |
| 206 | + """Initialize the camera.""" |
| 207 | + ... |
| 208 | + |
| 209 | + def deinit(self) -> None: |
| 210 | + """Deinitialize the camera.""" |
| 211 | + ... |
| 212 | + |
| 213 | + def set_dcw(self, value: bool) -> None: |
| 214 | + """Enable/disable DCW (Downsize EN).""" |
| 215 | + ... |
| 216 | + |
| 217 | + def get_dcw(self) -> bool: |
| 218 | + """Get DCW (Downsize EN) state.""" |
| 219 | + ... |
| 220 | + |
| 221 | + def set_sharpness(self, value: int) -> None: |
| 222 | + """Set the sharpness level (-2 to 2).""" |
| 223 | + ... |
| 224 | + |
| 225 | + def get_sharpness(self) -> int: |
| 226 | + """Get the sharpness level.""" |
| 227 | + ... |
| 228 | + |
| 229 | + def set_saturation(self, value: int) -> None: |
| 230 | + """Set the saturation level (-2 to 2).""" |
| 231 | + ... |
| 232 | + |
| 233 | + def get_saturation(self) -> int: |
| 234 | + """Get the saturation level.""" |
| 235 | + ... |
| 236 | + |
| 237 | + def set_raw_gma(self, value: bool) -> None: |
| 238 | + """Enable/disable GMA (Gamma) Correction.""" |
| 239 | + ... |
| 240 | + |
| 241 | + def get_raw_gma(self) -> bool: |
| 242 | + """Get GMA (Gamma) Correction state.""" |
| 243 | + ... |
| 244 | + |
| 245 | + def set_quality(self, value: int) -> None: |
| 246 | + """Set JPEG quality (0-63).""" |
| 247 | + ... |
| 248 | + |
| 249 | + def get_quality(self) -> int: |
| 250 | + """Get JPEG quality.""" |
| 251 | + ... |
| 252 | + |
| 253 | + def set_frame_size(self, value: int) -> None: |
| 254 | + """Set frame size.""" |
| 255 | + ... |
| 256 | + |
| 257 | + def get_frame_size(self) -> int: |
| 258 | + """Get frame size.""" |
| 259 | + ... |
| 260 | + |
| 261 | + def set_exposure_ctrl(self, value: bool) -> None: |
| 262 | + """Enable/disable Auto Exposure Control.""" |
| 263 | + ... |
| 264 | + |
| 265 | + def get_exposure_ctrl(self) -> bool: |
| 266 | + """Get Auto Exposure Control state.""" |
| 267 | + ... |
| 268 | + |
| 269 | + def set_denoise(self, value: int) -> None: |
| 270 | + """Set denoise level.""" |
| 271 | + ... |
| 272 | + |
| 273 | + def get_denoise(self) -> int: |
| 274 | + """Get denoise level.""" |
| 275 | + ... |
| 276 | + |
| 277 | + def set_gain_ctrl(self, value: bool) -> None: |
| 278 | + """Enable/disable Auto Gain Control.""" |
| 279 | + ... |
| 280 | + |
| 281 | + def get_gain_ctrl(self) -> bool: |
| 282 | + """Get Auto Gain Control state.""" |
| 283 | + ... |
| 284 | + |
| 285 | + def set_lenc(self, value: bool) -> None: |
| 286 | + """Enable/disable Lens Correction.""" |
| 287 | + ... |
| 288 | + |
| 289 | + def get_lenc(self) -> bool: |
| 290 | + """Get Lens Correction state.""" |
| 291 | + ... |
| 292 | + |
| 293 | + def set_hmirror(self, value: bool) -> None: |
| 294 | + """Enable/disable horizontal mirror.""" |
| 295 | + ... |
| 296 | + |
| 297 | + def get_hmirror(self) -> bool: |
| 298 | + """Get horizontal mirror state.""" |
| 299 | + ... |
| 300 | + |
| 301 | + def set_gainceiling(self, value: int) -> None: |
| 302 | + """Set gain ceiling.""" |
| 303 | + ... |
| 304 | + |
| 305 | + def get_gainceiling(self) -> int: |
| 306 | + """Get gain ceiling.""" |
| 307 | + ... |
| 308 | + |
| 309 | + def frame_available(self) -> bool: |
| 310 | + """Check if a frame is available.""" |
| 311 | + ... |
| 312 | + |
| 313 | + def capture(self) -> memoryview: |
| 314 | + """Capture a frame and return it as a memoryview.""" |
| 315 | + ... |
| 316 | + |
| 317 | + def free_buffer(self) -> None: |
| 318 | + """Free the frame buffer.""" |
| 319 | + ... |
| 320 | + |
| 321 | + def get_pixel_width(self) -> int: |
| 322 | + """Get frame width in pixels.""" |
| 323 | + ... |
| 324 | + |
| 325 | + def get_pixel_height(self) -> int: |
| 326 | + """Get frame height in pixels.""" |
| 327 | + ... |
| 328 | + |
| 329 | + def get_pixel_format(self) -> int: |
| 330 | + """Get current pixel format.""" |
| 331 | + ... |
| 332 | + |
| 333 | + def get_sensor_name(self) -> str: |
| 334 | + """Get camera sensor name.""" |
| 335 | + ... |
| 336 | + |
| 337 | + def get_max_frame_size(self) -> int: |
| 338 | + """Get maximum supported frame size.""" |
| 339 | + ... |
| 340 | + |
| 341 | + def get_fb_count(self) -> int: |
| 342 | + """Get frame buffer count.""" |
| 343 | + ... |
| 344 | + |
| 345 | + def get_grab_mode(self) -> int: |
| 346 | + """Get current grab mode.""" |
| 347 | + ... |
| 348 | + |
0 commit comments