File size: 490 Bytes
ec9a6bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import torch
import torch.nn as nn


class CameraModule(nn.Module):
    def __init__(self, image_size):
        super(CameraModule, self).__init__()
        self.image_size = image_size

    def perspective(self, query_pts, calibrations):
        query_pts = torch.bmm(calibrations[:, :3, :3], query_pts)
        query_pts = query_pts + calibrations[:, :3, 3:4]
        query_pts_xy = query_pts[:, :2, :] / query_pts[:, 2:, :]
        query_pts_xy = query_pts_xy
        return query_pts_xy