Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove image decoding from calibrationUtils.py #1633

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions devTools/calibrationUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ class JsonMatOfDoubles:
data: list[float]


@dataclass
class JsonMat:
rows: int
cols: int
type: int
data: str # Base64-encoded PNG data


@dataclass
class Point2:
x: float
Expand Down Expand Up @@ -84,8 +76,6 @@ class Observation:
# If we should use this observation when re-calculating camera calibration
includeObservationInCalibration: bool
snapshotName: str
# The actual image the snapshot is from
snapshotData: JsonMat


@dataclass
Expand Down Expand Up @@ -206,14 +196,6 @@ def from_dict(cls, dict):
if not os.path.exists(output_folder):
os.makedirs(output_folder)

# Decode each image and save it as a png
for obs in camera_cal_data.observations:
image = obs.snapshotData.data
decoded_data = base64.b64decode(image)
np_data = np.frombuffer(decoded_data, np.uint8)
img = cv2.imdecode(np_data, cv2.IMREAD_UNCHANGED)
cv2.imwrite(f"{output_folder}/{obs.snapshotName}", img)

# And create a VNL file for use with mrcal
with open(f"{output_folder}/corners.vnl", "w+") as vnl_file:
vnl_file.write("# filename x y level\n")
Expand Down
Loading