kwea123/CasMVSNet_pl

A question when test on dtu

LuckyOne09 opened this issue · 2 comments

Hi, I have a question when I test on dtu dataset.
I specify self.img_wh of DTUDataset as (640, 512)(in other words, same as training image size). I think intrinsics read from self.root_dir/Cameras/{vid:08d}_cam.txtwill be same as intrinsics read from self.root_dir/Cameras/train/{vid:08d}_cam.txt after line 64 in dtu.py.
However, they are not same.

I print intrinsics after line 64:

[[289.233      0.        82.3204  ]
 [  0.       307.5392    66.034134]
 [  0.         0.         1.      ]]

while intrinsics read from self.root_dir/Cameras/train/{vid:08d}_cam.txt is:

361.54125      0.0      82.900625 
0.0      360.3975      66.383875 
0.0      0.0      1.0  

I don't figure out that what's wrong with my thoughts. Could you give me some hints on it? Please forgive me if it is a stupid question. Very thanks for your kindness.

In the MVSNet paper, he described how the training images are generated. They are not direct resize but a resize followed by a crop. I have comments in the code too:

depth = np.array(read_pfm(filename)[0], dtype=np.float32) # (1200, 1600)
if self.img_wh is None:
depth = cv2.resize(depth, None, fx=0.5, fy=0.5,
interpolation=cv2.INTER_NEAREST) # (600, 800)
depth_0 = depth[44:556, 80:720] # (512, 640)

Therefore, the intrinsics are not the same, because cropping changes the parameters differently. My test code uses resize only.

Thank you! It helps me a lot.