Skip to content

Commit 4196a8a

Browse files
committed
fixing minor issues for PR
1 parent 6524f31 commit 4196a8a

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

modules/camera/camera_arducamir.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
import cv2
88

99
import ArducamEvkSDK
10-
from ArducamEvkSDK import Camera, Frame, Param
1110
import arducam_rgbir_remosaic
1211

1312
from . import base_camera
1413

14+
CAMERA_CONFIG_DIR = "./config/camera_config.cfg"
15+
1516

1617
class ArducamOutput(enum.Enum):
1718
"""
@@ -34,13 +35,12 @@ def create(
3435
cls, width: int, height: int, config: None
3536
) -> "tuple[True, CameraArducamIR] | tuple[False, None]":
3637

37-
camera = Camera()
38+
camera = ArducamEvkSDK.Camera()
3839

39-
param = Param()
40-
param.config_file_name = "./config/camera_config.cfg"
40+
param = ArducamEvkSDK.Param()
41+
param.config_file_name = CAMERA_CONFIG_DIR
4142

4243
if not camera.open(param):
43-
print("Error trying to open Arducam camera")
4444
return False, None
4545

4646
return True, CameraArducamIR(cls.__create_key, camera)
@@ -66,7 +66,7 @@ def __del__(self) -> None:
6666
self.__camera.stop()
6767
self.__camera.close()
6868

69-
def run(self) -> tuple[True, Frame] | tuple[False, None]:
69+
def run(self) -> tuple[True, ArducamEvkSDK.Frame] | tuple[False, None]:
7070
"""
7171
Takes a picture with ArducamIR camera.
7272
@@ -78,7 +78,7 @@ def run(self) -> tuple[True, Frame] | tuple[False, None]:
7878

7979
return True, image_data
8080

81-
def demosaic(self, image: Frame, output: ArducamOutput) -> np.ndarray | None:
81+
def demosaic(self, image: ArducamEvkSDK.Frame, output: ArducamOutput) -> np.ndarray | None:
8282
"""
8383
Converts Bayer Pattern & IR data to OpenCV Matrix
8484
"""
@@ -98,7 +98,7 @@ def demosaic(self, image: Frame, output: ArducamOutput) -> np.ndarray | None:
9898
return ir_resize
9999
raise ValueError(f"Error. Invalid output type: {output}")
100100

101-
def format(self, image: Frame) -> np.ndarray:
101+
def format(self, image: ArducamEvkSDK.Frame) -> np.ndarray:
102102
"""
103103
Formats byte buffer sensor input into 8-bit arrays
104104
"""

modules/camera/camera_factory.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def create_camera(
3737
case CameraOption.PICAM2:
3838
return camera_picamera2.CameraPiCamera2.create(width, height, config)
3939
case CameraOption.ARDUCAMIR:
40-
if config is not None: # ArducamIR does not have configurable settings
41-
return False, None
4240
return camera_arducamir.CameraArducamIR.create(width, height, config)
4341

4442
return False, None

tests/integration/test_camera_arducamir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def main() -> int:
3131
continue
3232

3333
if image.seq % 50 == 0: # Avoiding too many prints, 50 is an arbitrary number
34-
print(f"Timestamp: [{0:s}]", time.ctime(float(image.timestamp / 10**3)))
34+
print("Timestamp: [{0:s}]", time.ctime(float(image.timestamp / 10**3)))
3535
print("Bit Depth: {0:2d}", image.format.bit_depth)
3636
print("Format Code: {0:2d}", image.format.format_code)
3737
print("Height: {0:3d}", image.format.height)

0 commit comments

Comments
 (0)