Skip to content

Commit

Permalink
Merge pull request #2593 from drdanz/fix_rectificationMatrix_param
Browse files Browse the repository at this point in the history
Fix a couple of typos
  • Loading branch information
drdanz authored Jun 8, 2021
2 parents 636c0ab + 9800983 commit 18539a7
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 25 deletions.
2 changes: 1 addition & 1 deletion data/yarpmanager/tests/xml/modules/fakeFrameGrabber.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<param default="10.0" required="no" desc="Radial distortion coefficient of the lens(fake)">k3</param>
<param default="11.0" required="no" desc="Tangential distortion of the lens(fake)">t1</param>
<param default="12.0" required="no" desc="Tangential distortion of the lens(fake)">t2</param>
<param default="1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" required="no" desc="Matrix that describes the lens' distortion(fake)">retificationMatrix</param>
<param default="1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" required="no" desc="Matrix that describes the lens' distortion(fake)">rectificationMatrix</param>
<param default="FishEye" required="no" desc="Reference to group of parameters describing the distortion model of the camera">distortionModel</param>
</arguments>

Expand Down
2 changes: 1 addition & 1 deletion data/yarpmanager/tests/xml/modules/test_grabber.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<param default="5.0" required="no" desc="">focalLengthY</param>
<param default="6.0" required="no" desc="">principalPointX</param>
<param default="7.0" required="no" desc="">principalPointY</param>
<param default="1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" required="no" desc="">retificationMatrix</param>
<param default="1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" required="no" desc="">rectificationMatrix</param>
<param default="FishEye" required="no" desc="">distortionModel</param>
<param default="8.0" required="no" desc="">k1</param>
<param default="9.0" required="no" desc="">k2</param>
Expand Down
2 changes: 1 addition & 1 deletion doc/device_invocation/fakeFrameGrabber_basic.dox
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ So this is just an example
<tr><td>focalLengthY</td><td>Vertical component of the focal length of the fakeFrameGrabber</td><td>5.0</td></tr>
<tr><td>principalPointX</td><td>X coordinate of the principal point of the fakeFrameGrabber</td><td>6.0</td></tr>
<tr><td>principalPointY</td><td>Y coordinate of the principal point of the fakeFrameGrabber</td><td>7.0</td></tr>
<tr><td>retificationMatrix</td><td>Matrix that describes the lens' distortion(fake)</td><td>1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0</td></tr>
<tr><td>rectificationMatrix</td><td>Matrix that describes the lens' distortion(fake)</td><td>1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0</td></tr>
<tr><td>distortionModel</td><td>Reference to group of parameters describing the distortion model of the camera</td><td>FishEye</td></tr>
<tr><td>k1</td><td>Radial distortion coefficient of the lens(fake)</td><td>8.0</td></tr>
<tr><td>k2</td><td>Radial distortion coefficient of the lens(fake)</td><td>9.0</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion doc/device_invocation/group_basic.dox
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ So this is just an example
<tr><td>mycam.focalLengthY</td><td>Vertical component of the focal length of the fakeFrameGrabber</td><td>5.0</td></tr>
<tr><td>mycam.principalPointX</td><td>X coordinate of the principal point of the fakeFrameGrabber</td><td>6.0</td></tr>
<tr><td>mycam.principalPointY</td><td>Y coordinate of the principal point of the fakeFrameGrabber</td><td>7.0</td></tr>
<tr><td>mycam.retificationMatrix</td><td>Matrix that describes the lens' distortion(fake)</td><td>1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0</td></tr>
<tr><td>mycam.rectificationMatrix</td><td>Matrix that describes the lens' distortion(fake)</td><td>1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0</td></tr>
<tr><td>mycam.distortionModel</td><td>Reference to group of parameters describing the distortion model of the camera</td><td>FishEye</td></tr>
<tr><td>mycam.k1</td><td>Radial distortion coefficient of the lens(fake)</td><td>8.0</td></tr>
<tr><td>mycam.k2</td><td>Radial distortion coefficient of the lens(fake)</td><td>9.0</td></tr>
Expand Down
22 changes: 22 additions & 0 deletions doc/release/master/fix_rectificationMatrix_param.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fix_rectificationMatrix_param {#master}
-----------------------------

## Libraries

### `sig`

#### `IntrinsicParams`

* Deprecate `YARP_PLUM_BOB` in favour of `YARP_PLUMB_BOB`



### `dev`

#### `IDepthVisualParams`

* The `retificationMatrix` parameter was renamed `rectificationMatrix`

#### `IRgbVisualParams`

* The `retificationMatrix` parameter was renamed `rectificationMatrix`
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ bool commonImageProcessor::getIntrinsicParam(yarp::os::Property& intrinsic) cons
// distortion model
if (m_lastCameraInfo.distortion_model=="plumb_bob")
{
params.distortionModel.type = YarpDistortion::YARP_PLUM_BOB;
params.distortionModel.type = YarpDistortion::YARP_PLUMB_BOB;
params.distortionModel.k1 = m_lastCameraInfo.D[0];
params.distortionModel.k2 = m_lastCameraInfo.D[1];
params.distortionModel.t1 = m_lastCameraInfo.D[2];
Expand Down
2 changes: 1 addition & 1 deletion src/devices/fakeFrameGrabber/FakeFrameGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ bool FakeFrameGrabber::open(yarp::os::Searchable& config) {

Value* retM;
retM=Value::makeList("1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0");
intrinsic.put("retificationMatrix",config.check("retificationMatrix",*retM,"Matrix that describes the lens' distortion(fake)"));
intrinsic.put("rectificationMatrix",config.check("rectificationMatrix",*retM,"Matrix that describes the lens' distortion(fake)"));
delete retM;

intrinsic.put("distortionModel",config.check("distortionModel",Value("FishEye"),"Reference to group of parameters describing the distortion model of the camera").asString());
Expand Down
4 changes: 2 additions & 2 deletions src/devices/usbCamera/linux/V4L_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ bool V4L_camera::fromConfig(yarp::os::Searchable& config)
configFy = config.check("verticalFov");
configPPx = config.check("principalPointX");
configPPy = config.check("principalPointY");
configRet = config.check("retificationMatrix");
configRet = config.check("rectificationMatrix");
configDistM = config.check("distortionModel");
Bottle bt;
bt = config.findGroup("cameraDistortionModelGroup");
Expand Down Expand Up @@ -545,7 +545,7 @@ bool V4L_camera::fromConfig(yarp::os::Searchable& config)
param.intrinsic.put("focalLengthY", config.check("focalLengthY", Value(0.0), "Vertical component of the focal lenght").asFloat64());
param.intrinsic.put("principalPointX", config.check("principalPointX", Value(0.0), "X coordinate of the principal point").asFloat64());
param.intrinsic.put("principalPointY", config.check("principalPointY", Value(0.0), "Y coordinate of the principal point").asFloat64());
param.intrinsic.put("retificationMatrix", config.check("retificationMatrix", *retM, "Matrix that describes the lens' distortion"));
param.intrinsic.put("rectificationMatrix", config.check("rectificationMatrix", *retM, "Matrix that describes the lens' distortion"));
param.intrinsic.put("distortionModel", config.check("distortionModel", Value(""), "Reference to group of parameters describing the distortion model of the camera").asString());
if (bt.isNull()) {
param.intrinsic.put("name", "");
Expand Down
4 changes: 2 additions & 2 deletions src/libYARP_dev/src/yarp/dev/IVisualParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class YARP_dev_API yarp::dev::IRgbVisualParams
* | focalLengthY | - | double | pixel | - | Yes | Vertical component of the focal length as a multiple of pixel height | |
* | principalPointX | - | double | pixel | - | Yes | X coordinate of the principal point | |
* | principalPointY | - | double | pixel | - | Yes | Y coordinate of the principal point | |
* | retificationMatrix | - | 4x4 double matrix | - | - | Yes | Matrix that describes the lens' distortion | |
* | rectificationMatrix | - | 4x4 double matrix | - | - | Yes | Matrix that describes the lens' distortion | |
* | distortionModel | - | string | - | - | Yes | Reference to group of parameters describing the distortion model of the camera, example 'cameraDistortionModelGroup' | This is another group's name to be searched for in the config file |
* | cameraDistortionModelGroup | | | | | | | |
* | | name | string | - | - | Yes | Name of the distortion model, see notes | right now only 'plumb_bob' is supported |
Expand Down Expand Up @@ -238,7 +238,7 @@ class YARP_dev_API yarp::dev::IDepthVisualParams
* | focalLengthY | - | double | pixel | - | Yes | Vertical component of the focal length as a multiple of pixel height | |
* | principalPointX | - | double | pixel | - | Yes | X coordinate of the principal point | |
* | principalPointY | - | double | pixel | - | Yes | Y coordinate of the principal point | |
* | retificationMatrix | - | 4x4 double matrix | - | - | Yes | Matrix that describes the lens' distortion | |
* | rectificationMatrix | - | 4x4 double matrix | - | - | Yes | Matrix that describes the lens' distortion | |
* | distortionModel | - | string | - | - | Yes | Reference to group of parameters describing the distortion model of the camera, example 'cameraDistortionModelGroup' | This is another group's name to be searched for in the config file |
* | cameraDistortionModelGroup | | | | | | | |
* | | name | string | - | - | Yes | Name of the distortion model, see notes | right now only 'plumb_bob' is supported |
Expand Down
4 changes: 2 additions & 2 deletions src/libYARP_sig/src/yarp/sig/IntrinsicParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void IntrinsicParams::toProperty(yarp::os::Property& intrinsic) const
intrinsic.put("principalPointY", principalPointY);
intrinsic.put("stamp", yarp::os::Time::now());

if (distortionModel.type != YarpDistortion::YARP_PLUM_BOB) {
if (distortionModel.type != YarpDistortion::YARP_PLUMB_BOB) {
intrinsic.put("distortionModel", "none");
return;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ void IntrinsicParams::fromProperty(const yarp::os::Property& intrinsic)
if (intrinsic.find("distortionModel").asString() != "plumb_bob") {
return;
}
distortionModel.type = YarpDistortion::YARP_PLUM_BOB;
distortionModel.type = YarpDistortion::YARP_PLUMB_BOB;
distortionModel.k1 = intrinsic.check("k1", yarp::os::Value(0.0)).asFloat64();
distortionModel.k2 = intrinsic.check("k2", yarp::os::Value(0.0)).asFloat64();
distortionModel.t1 = intrinsic.check("t1", yarp::os::Value(0.0)).asFloat64();
Expand Down
14 changes: 9 additions & 5 deletions src/libYARP_sig/src/yarp/sig/IntrinsicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ namespace sig {
*/
enum class YarpDistortion : std::int32_t
{
YARP_DISTORTION_NONE, /**< Rectilinear images. No distortion compensation required. */
YARP_PLUM_BOB, /**< Plumb bob distortion model */
YARP_FISH_EYE, /**< Fish eye distortion model */
YARP_UNSUPPORTED, /**< Unsupported distortion model */
YARP_DISTORTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
YARP_DISTORTION_NONE, /**< Rectilinear images. No distortion compensation required. */
YARP_PLUMB_BOB, /**< Plumb bob distortion model */
YARP_FISH_EYE, /**< Fish eye distortion model */
YARP_UNSUPPORTED, /**< Unsupported distortion model */
YARP_DISTORTION_COUNT, /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */

#ifndef YARP_NO_DEPRECATED // Since YARP 3.5
YARP_PLUM_BOB YARP_DEPRECATED_MSG("Use YARP_PLUMB_BOB instead") = YARP_PLUMB_BOB, /**< Deprecated name for plumb bob distortion model */
#endif
};

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/libYARP_dev/fakeFrameGrabberTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
CHECK(intrinsics.find("t2").asFloat64() == 12.0); // checking t2
CHECK(intrinsics.find("distortionModel").asString() == "FishEye"); // checking distorionModel

// checking the retificationMatrix
retM = intrinsics.find("retificationMatrix").asList();
// checking the rectificationMatrix
retM = intrinsics.find("rectificationMatrix").asList();
double data[9]= {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
Vector v(9,data);
Vector v2;
Expand Down Expand Up @@ -263,8 +263,8 @@ TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
CHECK(intrinsics.find("t2").asFloat64() == 12.0); // checking t2
CHECK(intrinsics.find("distortionModel").asString() == "FishEye"); // checking distorionModel

// checking the retificationMatrix
retM = intrinsics.find("retificationMatrix").asList();
// checking the rectificationMatrix
retM = intrinsics.find("rectificationMatrix").asList();
double data[9]= {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
Vector v(9,data);
Vector v2;
Expand Down Expand Up @@ -295,8 +295,8 @@ TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
CHECK(Network::exists("/grabber/left/rpc"));
CHECK(Network::exists("/grabber/right/rpc"));

// checking the retificationMatrix
retM = bt.find("retificationMatrix").asList();
// checking the rectificationMatrix
retM = bt.find("rectificationMatrix").asList();
Portable::copyPortable(*retM,v2);
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
Expand Down Expand Up @@ -347,8 +347,8 @@ TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
CHECK(intrinsics.find("t2").asFloat64() == 12.0); // checking t2
CHECK(intrinsics.find("distortionModel").asString() == "FishEye"); // checking distorionModel

// checking the retificationMatrix
retM = intrinsics.find("retificationMatrix").asList();
// checking the rectificationMatrix
retM = intrinsics.find("rectificationMatrix").asList();

Portable::copyPortable(*retM, v2);
for(int i=0; i<3; i++) {
Expand Down

0 comments on commit 18539a7

Please sign in to comment.