点云数据
点云数据
封印序列
序列并查集
dataset
DatasetDataset类是torch中的一个常用的用于数据数据集读取的类
1234567891011121314151617181920212223242526272829import torchfrom torch.utils.data import Datasetfrom PIL import Imageimport osclass MyDataset(Dataset): def __init__(self, root_dir, label_dir): self.root_dir = root_dir self.label_dir = label_dir self.path = os.path.join(self.root_dir, self.label_dir) self.img_dir = os.listdir(self.path) def __getitem__(self,idx): img_name = self.img_dir[idx] img_item_pth = os ...
插值法
插值法Introduction图像是由像素构成的,在对图像进行放大的过程中,未知区域的像素值通过原图像计算得到。
坐标对应公式x = x^{'} \times \frac{w}{w^{'}}y = y^{'} \times \frac{h}{h^{'}}$x,y$:原图像的像素坐标$x^{‘},y^{‘}$:放大后的图像坐标$w,h$:图像的宽、高$w^{‘},h^{‘}$:放大后的图像宽高
最近邻插值法直接将与$x,y$最近的坐标的像素值赋给$x^{‘},y^{‘}$。
双线性插值基于线性关系,通过三次单线性插值得到像素值。
\frac{y-y_1}{x-x_1} = \frac{y_2-y_1}{x_2-x_1}经过简单整理得到:
y = \frac{x_2 - x}{x_2-x1} \times x_1 + \frac{x-x_1}{x_2-x_1} \times y_2
具体步骤:
对Q_{12},Q_{22}(横轴方向)平面进行单线性插值得到$R_2$,同理得到$R_1$
最后对$R_1,R_2$(纵轴方向)平面再进行一次单线性插值,就得到$P$
注意到$x_2 - x1 ...
算法设计与分析课程综合复习
算法设计与分析课程复习
线段树
线段树主要涉及区间的修改和查询
并查集
并查集维护集合关系
食材运输
状压DP解决区间覆盖