cars_mesh.core.texture ====================== .. py:module:: cars_mesh.core.texture .. autoapi-nested-parse:: Texturing methods to project radiometric information over surfaces to provide a realistic rendering. Functions --------- .. autoapisummary:: cars_mesh.core.texture.tile_norm cars_mesh.core.texture.process_raster_by_tile cars_mesh.core.texture.preprocess_image_texture cars_mesh.core.texture.generate_uvs cars_mesh.core.texture.texturing Module Contents --------------- .. py:function:: tile_norm(arr: numpy.ndarray, q_percent: Union[tuple, list, numpy.ndarray] = None) Normalize an image to a 8-bit image by recomputing the color dynamic :param arr: Image array :type arr: np.ndarray :param q_percent: Percentage of the respectively minimum and maximum values of the image from which to clip the dynamic :type q_percent: (2, ) list or tuple or np.ndarray .. py:function:: process_raster_by_tile(rio_infile, rio_outfile, fn_process_tile, col_off=0, row_off=0, tile_size=(1000, 1000), dst_bands=None, **kwargs) Function that executes a user defined function using a tiling process. :param rio_infile: :type rio_infile: rasterio.io.DatasetReader :param rio_outfile: :type rio_outfile: rasterio.io.DatasetWriter :param fn_process_tile: :type fn_process_tile: Function :param col_off: :type col_off: int :param row_off: :type row_off: int :param tile_size: (row, col) :type tile_size: tuple or list or np.ndarray :param dst_bands: List of bands to handle in input and output file :type dst_bands: list or tuple or np.ndarray or None :param kwargs: .. py:function:: preprocess_image_texture(img_path: str, bbox: Union[tuple, list, numpy.ndarray], output_dir: str, tile_size: Union[tuple, list, numpy.ndarray] = (1000, 1000)) Function that transforms a 16-bit tif image into an 8-bit jpg cropped to a bbox extent :param img_path: Path to the TIF image to crop and normalize :type img_path: str :param bbox: Bounding box extent for cropping: [top_left_col, top_left_row, bottom_right_col, bottom_right_row] :type bbox: list or tuple or np.ndarray :param output_dir: Output directory path :type output_dir: str :param tile_size: Tile size for the processing applied by tile for memory purpose (row, col) :type tile_size: (2, ) tuple or list or np.ndarray .. py:function:: generate_uvs(img_pts: Union[tuple, list, numpy.ndarray], triangles: Union[tuple, list, numpy.ndarray], bbox: Union[tuple, list, numpy.ndarray], img_texture_size: Union[tuple, list, numpy.ndarray]) -> numpy.ndarray Function that computes the UVs coordinates :param img_pts: Equivalent image coordinates of ground point cloud data :type img_pts: (N, 2) list or tuple or np.ndarray :param triangles: Mesh triangle indexes. The indexes must correspond to the 'img_pts' indexes. :type triangles: (M, 3) list or tuple or np.ndarray :param bbox: List of coordinates for respectively the top left and bottom right corners in image frame and in the order (col, row) :type bbox: (4, ) list or tuple or np.ndarray :param img_texture_size: Size (col, row) of the image texture :type img_texture_size: (2, ) list or tuple or np.ndarray :returns: **uvs** -- Normalized coordinates in the image texture of each triangle vertex. Normalization is done according to the image texture size and in [0, 1] :rtype: np.ndarray .. py:function:: texturing(mesh: cars_mesh.tools.handlers.Mesh, cfg: dict) -> cars_mesh.tools.handlers.Mesh Function that creates the texture of a mesh. :param mesh: Mesh object :type mesh: Mesh :param cfg: Configuration dictionary. The algorithm retrieves the following information: * output_dir: Str Output directory to write the new texture image. * rpc_path: Str Path to the xml rpc file. * tif_img_path: Str Path to the TIF image. * utm_code: int UTM code of the point cloud :type cfg: dict: :returns: **mesh** -- Mesh object with texture parameters :rtype: Mesh