thanif / CPL

MS-Thesis: Proposed a new loss function for estimating Camera Calibration parameters along with a new dataset -- (CVGL Camera Calibration Dataset)
26 stars 3 forks source link

can i use my own pics to get the result #6

Closed BumbleBaozi closed 1 year ago

BumbleBaozi commented 1 year ago

Hello, thank you for sharing. Secondly, I would like to ask whether I can use the checkerboard image taken by myself as input to get internal and external parameters. I haven't been able to run through your code yet. May I ask how simple use, can achieve the above results. Looking forward to your reply! Thanks!

thanif commented 1 year ago

Yes, you can use your own pics to get the result as follows:

Left_images = [] Right_images = []

Read left and right image:

l_im = cv2.imread(data_path+folder+"/"+fname, 0) r_im = cv2.imread(datapath+folder+"/"+'RightRGB'+fname.split("_")[1], 0)

Left_images.append(l_im) Right_images.append(r_im)

Save images as npy files:

np.save(path+"li.npy",Left_images) np.save(path+"ri.npy",Right_images)

Load Data:

Left_images = np.load(data_path+"li.npy") Right_images = np.load(data_path+"ri.npy")

Load the weights:

model.load_weights('./new_logs/20221209-143908/model_multi_class/Best/weights_07_486.93.h5')

Test the model:

output = model.predict( x=[Left_images, Right_images], batch_size=16, verbose=1 )

BumbleBaozi commented 1 year ago

So sorry to bother you again. I recently studied your code and found that the 112x112 size image can get the calibration result. But because my experiment needs to be on a 3648x5472 size picture, I saw that your code involves a Dense fully connected layer. After consulting the information, it seems that an image with the same size as the weight file needs to be input. I don't know if there is a solution, thank you, looking forward to your reply.

thanif commented 1 year ago

Hi, What you can do is to first resize the image to 12544 and then reshape it to 112x112.