def crop_pointcloud(data_crop, x_o, y_o, x_i, y_i, R_o, R_i, z_critical): K_o = R_o ** 2 / range_z K_i = R_i ** 2 / range_z for z in range(range_z): r_o = np.sqrt(z * K_o) data_layer = data_crop[:, :, z] d_o = np.sqrt(x_o ** 2 + y_o ** 2) d_i = np.sqrt(x_i ** 2 + y_i ** 2) if z < z_critical: r_i = 0 else: r_i = np.sqrt(z * K_i) data_crop[:, :, z] = np.where((d_o > r_o) | (d_i <= r_i), 0, data_layer) return data_crop data_crop = data[:, :, :400] print(file_path) # np.savetxt('reshape_data.txt', data_crop, delimiter=',') range_x, range_y, range_z = data_crop.shape x, y = np.meshgrid(np.arange(range_x), np.arange(range_y)) # np.savetxt('reshape_data.txt', x, delimiter=' ', fmt="%i") x_o = x - range_x / 2 y_o = y - range_y / 2 x_i = x - dx y_i = y - dy z_critical = 50 R_o = 550 R_i = 200 data_crop = crop_pointcloud(data_crop, x_o, y_o, x_i, y_i, R_o, R_i, z_critical) data_crop = data_crop[:, :, 10:] C++ Eigen::Tensor
时间: 2024-03-19 08:41:01 浏览: 40
Crop_it.zip_I AM
Eigen::Tensor is a C++ library for tensor operations, developed by the Eigen team. It provides a high-level API for performing tensor operations, such as tensor addition, multiplication, and convolution. The library is designed to be fast and efficient, and provides support for both CPU and GPU acceleration. Eigen::Tensor is particularly useful for machine learning applications, where tensors are commonly used to represent data.
阅读全文