mvtec3d

以bagel为例,其中有calibration、

bagel			# 百吉圈(硬面包)
	calibration
		camera_parameters.json
	test
		combined
			gt	# 缺陷部位的分割剪影png
			rgb	# 原图png
			xyz	# tiff
		contamination	# 污染物
			同上
		crack
			同上
		good
			同上		
		hole
			同上		
	train
		good
			rgb
			xyz
	validation
		good
			同train
	class_ids.json
		

camera_parameters.json

{
   
  "camera_type": "area_scan_division",
  "focus": 0.0103431,
  "kappa": -2205.03,
  "sx": 3.74983e-06,
  "sy": 3.75e-06,
  "cx": 252.046,
  "cy": 450.07,
  "image_width": 800,
  "image_height": 800
}

class_ids.json如下
在这里插入图片描述
其余类别

cable_gland	缆线接头,缺陷:弯曲、末端破裂或者头部凹陷、洞、螺纹损坏
carrot	胡萝卜,缺陷:污染、裂纹、割痕、洞
cookie	饼干
dowel	暗榫(识图的话应该叫塑料膨胀管)
foam	鸡蛋托盘
peach
potato
rope	绞绳,缺陷:污染、裂痕、蓬松
tire

顺便记一下在gpt那问到的处理tiff的代码,可能用到?

import tifffile as tiff

# Attempt to read the TIFF file using tifffile
try:
    tiff_data = tiff.imread(file_path)
    # Display the shape of the array to understand its dimensions
    tiff_data_shape = tiff_data.shape
except Exception as e:
    tiff_data_shape = str(e)

tiff_data_shape

(800, 800, 3)

要从这种类型的图像中生成点云,我们可以遵循以下步骤:

将图像转换为灰度图。 遍历每个像素,使用其 x 和 y 坐标以及灰度值(作为 z 坐标)来生成点云。
我将进行这些转换并提供一个点云数据的示例。 ​​

# Convert the image to grayscale
gray_image = np.mean(tiff_data, axis=2)

# Generate point cloud data 
points = [] 
for y in range(gray_image.shape[0]):
    for x in range(gray_image.shape[1]):
        z = gray_image[y][x]  # Grayscale value as height
        points.append([x, y, z])

# Convert to numpy array for better handling 
point_cloud = np.array(points)

# Show the shape of the point cloud and a small sample of the data 
point_cloud_shape = point_cloud.shape 
point_cloud_sample = point_cloud[:5]  # First 5 points as a sample

point_cloud_shape, point_cloud_sample 
((640000, 3),  
array([[0. , 0.        , 0.14262693],
        [1.        , 0.        , 0.14268805],
        [2.        , 0.        , 0.14277673],
        [3.        , 0.        , 0.14286469],
        [4.        , 0.        , 0.14295126]]))

成功将图像转换为点云数据。生成的点云由 640,000 个点组成,每个点有三个坐标:x, y, 和 z。
这些坐标中,x 和 y 是像素的位置,而 z 是基于灰度值的高度(或深度)。

现在你可以使用 CloudCompare、MeshLab 或其他点云可视化工具来查看和分析这些数据。如果你选择使用 Python 进行可视化,可以使用 matplotlib、plotly 或类似库来创建三维散点图。

dl

相关推荐

  1. <span style='color:red;'>mvtec</span><span style='color:red;'>3</span><span style='color:red;'>d</span>

    mvtec3d

    2023-12-31 16:44:02      41 阅读
  2. ogre3d 资料

    2023-12-31 16:44:02       39 阅读
  3. 地牢手册-3d

    2023-12-31 16:44:02       40 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-31 16:44:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-31 16:44:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-31 16:44:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-31 16:44:02       20 阅读

热门阅读

  1. MySQL

    MySQL

    2023-12-31 16:44:02      34 阅读
  2. Crow:run的流程1 准备阶段

    2023-12-31 16:44:02       39 阅读
  3. 【AI】注意力机制与深度学习模型

    2023-12-31 16:44:02       35 阅读
  4. 算法每日一题:一周中的第几天 | 日历类题目

    2023-12-31 16:44:02       38 阅读
  5. Python面向对象编程

    2023-12-31 16:44:02       43 阅读
  6. Pytorch整体框架学习

    2023-12-31 16:44:02       43 阅读
  7. 判断素数的方法大全

    2023-12-31 16:44:02       43 阅读
  8. STL——常用算术生成算法

    2023-12-31 16:44:02       39 阅读