Model Registration
Zumbalamambo opened this issue · 9 comments
How do I register the model and get the yml file?
I did not implement the model registration in Python as I found the performance to be quite terrible(but I only tested it on a couple of images).
If you want to register your own model you have to refer back to the source at https://docs.opencv.org/master/dc/d2c/tutorial_real_time_pose.html under 1)Model registration. Hope this helps!
I have tried it but it is just generating an empty file!... i have inputted custom ply file that has got all the 3d points but still it is not working out.
As far as I can remember, the input should be an image. The program will then prompt you to select various points on it, so I don't think your input should be a ply file.
Unfortunately, it is asking for the ply file. :( https://github.com/opencv/opencv/blob/b3a07166baaccf87ec467be0fedc6ebe9ce86312/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp#L97
Hi, sorry you are right, it does also require the mesh file along with an image.
You mentioned that the output file is empty which im not sure why as even when i randomly tested it and clicked wrongly to get 0 inliers i got the below in the output yml file:
%YAML:1.0
points_3d: !!opencv-matrix
rows: 0
cols: 1
dt: "3f"
data: []
points_2d: !!opencv-matrix
rows: 0
cols: 1
dt: "2f"
data: []
keypoints:
[]
descriptors: !!opencv-matrix
rows: 0
cols: 0
dt: u
data: []
training_image_path: "resized_IMG_3875.JPG"
Maybe you can provide me with your image and ply file and I could give it a quick try :D
Sorry for the late reply, but I noticed your ply file is a binary file.The library provided by the author for reading plyfiles can be traced to CsvReader.cpp in this function ::
void CsvReader::readPLY(vector &list_vertex, vector<vector > &list_triangles)
Based on the function definition, it does not work as intended with binary ply files(nor does it raise errors either), hope this helps!
@Bingrong89 Could you please give a rough idea about how I can create a ply file that can be used to register the model?
As far as I am aware, ply files can be created using CAD software. Unfortunately I am not able to help you much in this area.
Just want to add on a few points if you are going to continue:
- The author stated, for the model registration method that : This program only works for planar objects, then if you want to model an object with complex shape you should use a sophisticated software to create it.
->Might want to check if the your object is suitable for this. - We have also to provide the intrinsic parameters of the camera with which the input image was taken
-> Camera calibration matrix, which in my script dof6.py is defined from line 27-31.
WIDTH & HEIGHT are for the image width and height.
FOCALLENGTH is in mm.
SENSOR_X/Y are the sensor sizes.
@Bingrong89 thanks for the input!