Convert the PCD files to depth images by running
将.txt文件--->d.tiff文件
直接贴代码:
!!此代码需在终端运行,命令最下面有,自己可以看着修改一下(pycharm下端终端和CMD都可,记得要cd 进文件所在目录!!!)
import argparse
import glob
import os
import numpy as np
from imageio import imsave
import warnings
import cv2
import matplotlib.pyplot as plt
import numpy as np
from imageio import imread
from skimage.transform import rotate, resize
warnings.filterwarnings("ignore", category=UserWarning)
class Image:
"""
Wrapper around an image with some convenient functions.
"""
def __init__(self, img):
self.img = img
def __getattr__(self, attr):
# Pass along any other methods to the underlying ndarray
return getattr(self.img, attr)
@classmethod
def from_file(cls, fname):
return cls(imread(fname))
def copy(self):
"""
:return: Copy of self.
"""
return self.__class__(self.img.copy())
def crop(self, top_left, bottom_right, resize=None):
"""
Crop the image to a bounding box given by top left and bottom right pixels.
:param top_left: tuple, top left pixel.
:param bottom_right: tuple, bottom right pixel
:param resize: If specified, resize the cropped image to this size
"""
self.img = self.img[top_left[0]:bottom_right[0], top_left[1]:bottom_right[1]]
if resize is not None:
self.resize(resize)
def normalis
689




被折叠的 条评论
为什么被折叠?



