paroj / pose_calib

Efficient Pose Selection for Interactive Camera Calibration
https://www.calibdb.net/
GNU Affero General Public License v3.0
68 stars 17 forks source link

A few questions #1

Closed pengsongyou closed 5 years ago

pengsongyou commented 5 years ago

Hi Pavel,

First, your work is really amazing and the codes are super clear and clean! I encounter a couple of questions when trying to run your code:

  1. After taking the first two initial images, 9 / 10 times the system would give me the error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() I even have made these two images vary quite largely to each other, but didn't really help. How should I solve this problem?

  2. It seems that your system would only provide some user_info (e.g. translate 'tx' to minimize ...) to guide a user, which was not as you described in your paper/demo, that there should be some marker overlays on the interface.

  3. Could you please provide a detailed readme file to tell users how to use your system or how to move correctly (like how to really translate 'tx')?

Thank you very much for your kind help!

paroj commented 5 years ago

After taking the first two initial images, 9 / 10 times the system would give me the error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

can you provide the full stack trace for this? The code requires OpenCV3 and may fail with OpenCV4.

It seems that your system would only provide some user_info (e.g. translate 'tx' to minimize ...) to guide a user, which was not as you described in your paper/demo, that there should be some marker overlays on the interface.

The user info is mostly for debug. There should be an overlay as shown here:

https://snapcraft.io/posecalib

pengsongyou commented 5 years ago

After taking the first two initial images, 9 / 10 times the system would give me the error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

can you provide the full stack trace for this? The code requires OpenCV3 and may fail with OpenCV4.

Please take a look at the trace below. But yeah, I am using OpenCV 4.1.0 with Python 2.7.15.


Traceback (most recent call last):
  File "pose_calib.py", line 143, in <module>
    main()
  File "pose_calib.py", line 120, in main
    ugui.update(force)
  File "/home/pengs/Documents/songyou/pose_calib/ui.py", line 221, in update
    self.set_next_pose()
  File "/home/pengs/Documents/songyou/pose_calib/ui.py", line 136, in set_next_pose
    self.calib.cdist)
  File "/home/pengs/Documents/songyou/pose_calib/posegen.py", line 191, in get_pose
    bounds = loc_from_dist(pts, dpts, mask=self.mask)[0]
  File "/home/pengs/Documents/songyou/pose_calib/distvis.py", line 100, in loc_from_dist
    bounds = get_bounds(thres_img, mask)
  File "/home/pengs/Documents/songyou/pose_calib/distvis.py", line 19, in get_bounds
    while contours:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

It seems that your system would only provide some user_info (e.g. translate 'tx' to minimize ...) to guide a user, which was not as you described in your paper/demo, that there should be some marker overlays on the interface.

The user info is mostly for debug. There should be an overlay as shown here:

https://snapcraft.io/posecalib

Thanks for the info. But when I was running your code directly like this python pose_calib.py -c data/calib_config.yml I was not able to get the overlay at all as shown below (As said, only had the user_info on the top of the window) Screenshot_2019-06-13_19-38-57

Thanks again for your kind help!!

paroj commented 5 years ago

ah, yes there were some changes in OpenCV4 regarding contours. You have to either update the code or downgrade to OpenCV3.

pengsongyou commented 5 years ago

ah, yes there were some changes in OpenCV4 regarding contours. You have to either update the code or downgrade to OpenCV3.

Hi, I have already downgraded my opencv-python and opencv-contrib-python to 3.4.0, and indeed the first problem did not happen any more. However, the overlay still cannot be seen and there are only some text info on the top of the window.

Could you please kindly let me know what to do in order to get the overlay?? Thanks so much again for your help!

paroj commented 5 years ago

thats strange. are there any other errors on the console? Also it seems you are on Ubuntu - did you try the snap already? Does it also lack overlays?

pengsongyou commented 5 years ago

The only "error" happens at the very beginning:

VIDIOC_S_CTRL: Invalid argument
VIDIOC_S_CTRL: Invalid argument
VIDIOC_S_CTRL: Input/output error

I installed the snap on my Ubuntu 18.04 but there is no response when I was trying to run it. Anyway, I actually urgently need to change a bit of your code (change the checkerboard) in order to do comparisons with my method, so the snap would not fit :)

Please kindly give some more advice, hahaha, I spent almost a day to figure out the problem..

paroj commented 5 years ago

I need more details to figure out what is going wrong on your side.

I installed the snap on my Ubuntu 18.04 but there is no response when I was trying to run it.

you must give it the camera permission. Also snap apps take some time on the first startup.

pengsongyou commented 5 years ago

I need more details to figure out what is going wrong on your side.

  • do the two initial overlays appear or are you not getting any overlays at all?

Hi, even for the first two initial poses, I don't get any overlays at all.

  • getting the snap to run would help narrowing down the problem substantially.

Ok I will try maybe on another computer.

I installed the snap on my Ubuntu 18.04 but there is no response when I was trying to run it.

you must give it the camera permission. Also snap apps take some time on the first startup.

pengsongyou commented 5 years ago

Hi Pavel,

I think I found the bug... Since I am using Python 2 and probably you developed your tool in Python 3, so in these two lines the self.SIZE[0]/sz[0] and self.SIZE[1]/sz[1] equal to 0 under Python 2, so the new K becomes: [[0. 0. 0.] [0. 0. 0.] [0. 0. 1.]] So when we want to project the image, the warped images are always black, so I did not see any overlays. I corrected this part and saw the overlays finally.

Now here is coming question: why do you choose the SIZE = (640, 480) in this line? What if I change the size of the input video source (currently the default size is (1280, 720)), do I need to change this SIZE accordingly?

One more question: what is the unit of square_len and marker_len in calib_confi.yml? Is it millimeter?

Thanks again to point out the possible issues on the first two images, so I could find the bug!

paroj commented 5 years ago

yes, the tool was developed with python3 - there might be more cases of unintended integer division. Ideally you should use python3 as well.

Now here is coming question: why do you choose the SIZE = (640, 480) in this line? What if I change the size of the input video source (currently the default size is (1280, 720)), do I need to change this SIZE accordingly?

that parameter only controls internal distortion map resolution. It is rescaled to the actual resolution later. No need to change that.

One more question: what is the unit of square_len and marker_len in calib_confi.yml? Is it millimeter?

yes, [mm]. However unless you want to use the estimated board positions, only the ratio of these two matters.

pengsongyou commented 5 years ago

Thank you very much for your supported help!!!