Skip to content

Commit 4778e9e

Browse files
typing: fix issues in from_array
1 parent 80cffb1 commit 4778e9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rosys/vision/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ def from_pil(cls, pil_image: PIL.Image.Image, *, camera_id: str = 'from_pil', ti
8686
return cls(camera_id=camera_id, size=size, time=time or rosys_time(), data=bytesio.getvalue())
8787

8888
@classmethod
89-
def from_array(cls, array: np.ndarray, *, camera_id: str | None = None, time: float | None = None) -> Self:
89+
def from_array(cls, array: np.ndarray, *, camera_id: str = 'from_array', time: float | None = None) -> Self:
9090
"""
9191
Create an Image from a numpy array. This runs a JPEG encode.
9292
"""
9393
_, encoded_image = cv2.imencode('.jpg', array)
94-
return cls(camera_id=camera_id, size=ImageSize(width=array.shape[1], height=array.shape[0]), time=time, data=encoded_image.tobytes())
94+
return cls(camera_id=camera_id, size=ImageSize(width=array.shape[1], height=array.shape[0]), time=time or rosys_time(), data=encoded_image.tobytes())
9595

9696
def to_array(self) -> np.ndarray:
9797
"""

0 commit comments

Comments
 (0)