Skip to content

Commit a1b0e6d

Browse files
authored
Update camera.md (#6828)
Fix the documentation of the return type of `getImage()` in Python. Add typing hints.
1 parent bbe0b93 commit a1b0e6d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/reference/camera.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -791,16 +791,16 @@ namespace webots {
791791
from controller import Camera
792792

793793
class Camera (Device):
794-
def getImage(self):
795-
def getImageArray(self):
794+
def getImage(self) -> bytes:
795+
def getImageArray(self) -> list[list[list[int]]]:
796796
@staticmethod
797-
def imageGetRed(image, width, x, y):
797+
def imageGetRed(image: bytes, width: int, x: int, y: int) -> int:
798798
@staticmethod
799-
def imageGetGreen(image, width, x, y):
799+
def imageGetGreen(image: bytes, width: int, x: int, y: int) -> int:
800800
@staticmethod
801-
def imageGetBlue(image, width, x, y):
801+
def imageGetBlue(image: bytes, width: int, x: int, y: int) -> int:
802802
@staticmethod
803-
def imageGetGray(image, width, x, y):
803+
def imageGetGray(image: bytes, width: int, x: int, y: int) -> int:
804804
# ...
805805
```
806806

@@ -895,8 +895,8 @@ Here is an example:
895895
896896
<!-- -->
897897
898-
> **Note** [Python]: The `getImage` function returns a `string`.
899-
This `string` is closely related to the `const char *` of the C API.
898+
> **Note** [Python]: The `getImage` function returns a byte array (`bytes`).
899+
This `bytes` is closely related to the `const char *` of the C API.
900900
`imageGet*`-like functions can be used to get the channels of the camera Here is an example:
901901
902902
> ```python

0 commit comments

Comments
 (0)