Skip to content

Data fields in struct cv::UsacParams not accesible through Python #18595

@aleromar

Description

@aleromar
System information (version)

Working on master branch (0d3e05f)
Relevant file: calib3d.hpp

Detailed description

When making use of cv::SolvePnPRansac the last argument is of type UsacParams. It is indeed possible to create an object of type UsacParams in Python since the structure is prefixed by CV_EXPORTS_W_SIMPLE in the c++ code. However, editing any of the data fields within the structure is not possible as the fields have not been prepended with CV_PROP_RW.

I've modified the implementation to add CV_PROP_RW to each field within UsacParams struct. Then declared a constructor.
The constructor implementation I added it to solvepnp.cpp. The constructor includes the values that previously could be found under UsacParams struct. I can now access each field appropriately.

Do I push my fix for this and create a PR?

Steps to reproduce
  • Build the repo
  • Under build directory, make install
  • Enter a python terminal
  • import cv2
  • up = cv2.UsacParams()
  • up.confidence -> Error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions