Change mjsCamera.resolution type from float to int.
Resolution is inherently an integer quantity (pixels). PiperOrigin-RevId: 848276456 Change-Id: I92ee1aa88fd552fd42cb3871442f020f26d6fa6a
This commit is contained in:
committed by
Copybara-Service
parent
9d646e6548
commit
f2e9097ed6
@@ -2106,11 +2106,11 @@ typedef struct mjsCamera_ { // camera specification
|
||||
|
||||
// intrinsics
|
||||
mjtProjection proj; // camera projection type
|
||||
int resolution[2]; // resolution (pixel)
|
||||
double fovy; // y-field of view
|
||||
double ipd; // inter-pupilary distance
|
||||
double ipd; // inter-pupillary distance
|
||||
float intrinsic[4]; // camera intrinsics (length)
|
||||
float sensor_size[2]; // sensor size (length)
|
||||
float resolution[2]; // resolution (pixel)
|
||||
float focal_length[2]; // focal length (length)
|
||||
float focal_pixel[2]; // focal length (pixel)
|
||||
float principal_length[2]; // principal point (length)
|
||||
|
||||
@@ -374,11 +374,11 @@ typedef struct mjsCamera_ { // camera specification
|
||||
|
||||
// intrinsics
|
||||
mjtProjection proj; // camera projection type
|
||||
int resolution[2]; // resolution (pixel)
|
||||
double fovy; // y-field of view
|
||||
double ipd; // inter-pupilary distance
|
||||
double ipd; // inter-pupillary distance
|
||||
float intrinsic[4]; // camera intrinsics (length)
|
||||
float sensor_size[2]; // sensor size (length)
|
||||
float resolution[2]; // resolution (pixel)
|
||||
float focal_length[2]; // focal length (length)
|
||||
float focal_pixel[2]; // focal length (pixel)
|
||||
float principal_length[2]; // principal point (length)
|
||||
|
||||
@@ -7570,6 +7570,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
type=ValueType(name='mjtProjection'),
|
||||
doc='camera projection type',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='resolution',
|
||||
type=ArrayType(
|
||||
inner_type=ValueType(name='int'),
|
||||
extents=(2,),
|
||||
),
|
||||
doc='resolution (pixel)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='fovy',
|
||||
type=ValueType(name='double'),
|
||||
@@ -7578,7 +7586,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='ipd',
|
||||
type=ValueType(name='double'),
|
||||
doc='inter-pupilary distance',
|
||||
doc='inter-pupillary distance',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='intrinsic',
|
||||
@@ -7596,14 +7604,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
doc='sensor size (length)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='resolution',
|
||||
type=ArrayType(
|
||||
inner_type=ValueType(name='float'),
|
||||
extents=(2,),
|
||||
),
|
||||
doc='resolution (pixel)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='focal_length',
|
||||
type=ArrayType(
|
||||
|
||||
@@ -1278,8 +1278,7 @@ int mjs_sensorDim(const mjsSensor* sensor) {
|
||||
if (sensor->objtype == mjOBJ_CAMERA) {
|
||||
const mjCCamera* camera = static_cast<const mjCCamera*>(
|
||||
static_cast<mjCSensor*>(sensor->element)->get_obj());
|
||||
return static_cast<int>(camera->spec.resolution[0]) *
|
||||
static_cast<int>(camera->spec.resolution[1]);
|
||||
return camera->spec.resolution[0] * camera->spec.resolution[1];
|
||||
}
|
||||
return 1; // site-attached: single ray
|
||||
|
||||
|
||||
@@ -3135,6 +3135,9 @@ struct MjsCamera {
|
||||
void set_proj(mjtProjection value) {
|
||||
ptr_->proj = value;
|
||||
}
|
||||
emscripten::val resolution() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(2, ptr_->resolution));
|
||||
}
|
||||
double fovy() const {
|
||||
return ptr_->fovy;
|
||||
}
|
||||
@@ -3153,9 +3156,6 @@ struct MjsCamera {
|
||||
emscripten::val sensor_size() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(2, ptr_->sensor_size));
|
||||
}
|
||||
emscripten::val resolution() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(2, ptr_->resolution));
|
||||
}
|
||||
emscripten::val focal_length() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(2, ptr_->focal_length));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user