Fix CSM settings from erroring
CSM settings was erroring due to reading properties that don't exist and calculating using nulls.
This commit is contained in:
parent
c2b8706fb5
commit
e71a25733b
1 changed files with 19 additions and 14 deletions
|
|
@ -104,20 +104,25 @@ export default {
|
||||||
"camera_stage_mapping",
|
"camera_stage_mapping",
|
||||||
"image_to_stage_displacement_matrix",
|
"image_to_stage_displacement_matrix",
|
||||||
);
|
);
|
||||||
this.csmResolution = await this.readThingProperty("camera_stage_mapping", "image_resolution");
|
if (csmMatrix) {
|
||||||
let streamResolution = await this.readThingProperty("camera", "stream_resolution");
|
this.csmResolution = await this.readThingProperty(
|
||||||
csmMatrix[0][0] = Number(csmMatrix[0][0].toFixed(3));
|
"camera_stage_mapping",
|
||||||
csmMatrix[0][1] = Number(csmMatrix[0][1].toFixed(3));
|
"image_resolution",
|
||||||
csmMatrix[1][0] = Number(csmMatrix[1][0].toFixed(3));
|
);
|
||||||
csmMatrix[1][1] = Number(csmMatrix[1][1].toFixed(3));
|
csmMatrix[0][0] = Number(csmMatrix[0][0].toFixed(3));
|
||||||
this.csmMatrix = csmMatrix;
|
csmMatrix[0][1] = Number(csmMatrix[0][1].toFixed(3));
|
||||||
this.csmRatio = Number((Math.abs(csmMatrix[1][0]) + Math.abs(csmMatrix[0][1])) / 2).toFixed(
|
csmMatrix[1][0] = Number(csmMatrix[1][0].toFixed(3));
|
||||||
3,
|
csmMatrix[1][1] = Number(csmMatrix[1][1].toFixed(3));
|
||||||
);
|
this.csmMatrix = csmMatrix;
|
||||||
this.csmFOV = [
|
this.csmRatio = Number((Math.abs(csmMatrix[1][0]) + Math.abs(csmMatrix[0][1])) / 2).toFixed(
|
||||||
Number(((streamResolution[0] ** 2 * this.csmRatio) / this.csmResolution[1]).toFixed(0)),
|
3,
|
||||||
Number(((streamResolution[1] ** 2 * this.csmRatio) / this.csmResolution[0]).toFixed(0)),
|
);
|
||||||
];
|
// Note [1] then [0] as CSM reports resolution as (y, x)
|
||||||
|
this.csmFOV = [
|
||||||
|
Number((this.csmResolution[1] * this.csmRatio).toFixed(0)),
|
||||||
|
Number((this.csmResolution[0] * this.csmRatio).toFixed(0)),
|
||||||
|
];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onRecalibrateResponse: function () {
|
onRecalibrateResponse: function () {
|
||||||
this.modalNotify("Finished stage-to-camera calibration.");
|
this.modalNotify("Finished stage-to-camera calibration.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue