Merge remote-tracking branch 'origin/main'

This commit is contained in:
leon 2025-03-25 17:01:06 +08:00
commit b4e1f6791b
22 changed files with 202 additions and 367 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
result/
.idea/
.vscode/

BIN
0_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 983 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 KiB

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
3_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

BIN
4_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
5_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 KiB

BIN
6_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
7_roi_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -1,272 +1 @@
[
{
"code": "1",
"type": "250x1450",
"x": "196.0",
"y": 0,
"center": "351",
"w": "1450",
"h": "250",
"angle": "0\u00b0"
},
{
"code": "2",
"type": "300x300",
"x": "174.0",
"y": 0,
"center": "754",
"w": "300",
"h": "300",
"angle": "0\u00b0"
},
{
"code": "3",
"type": "501x500",
"x": "889.5",
"y": 0,
"center": "1054.5",
"w": "500",
"h": "501",
"angle": "0\u00b0"
},
{
"code": "4",
"type": "250x648",
"x": "-32.0",
"y": 0,
"center": "1149",
"w": "648",
"h": "250",
"angle": "0\u00b0"
},
{
"code": "5",
"type": "250x250",
"x": "588.0",
"y": 0,
"center": "1543",
"w": "250",
"h": "250",
"angle": "0\u00b0"
},
{
"code": "6",
"type": "249x249",
"x": "1031.5",
"y": 0,
"center": "1750.5",
"w": "249",
"h": "249",
"angle": "0\u00b0"
},
{
"code": "7",
"type": "400x399",
"x": "-199.5",
"y": 0,
"center": "1955",
"w": "399",
"h": "400",
"angle": "0\u00b0"
},
{
"code": "8",
"type": "300x302",
"x": "394.0",
"y": 0,
"center": "2159",
"w": "302",
"h": "300",
"angle": "0\u00b0"
},
{
"code": "9",
"type": "300x302",
"x": "996.0",
"y": 0,
"center": "2157",
"w": "302",
"h": "300",
"angle": "0\u00b0"
},
{
"code": "10",
"type": "248x1447",
"x": "2190.0",
"y": 0,
"center": "345",
"w": "1447",
"h": "248",
"angle": "0\u00b0"
},
{
"code": "11",
"type": "298x297",
"x": "2198.5",
"y": 0,
"center": "747",
"w": "297",
"h": "298",
"angle": "0\u00b0"
},
{
"code": "12",
"type": "499x499",
"x": "2891.0",
"y": 0,
"center": "1040.5",
"w": "499",
"h": "499",
"angle": "0\u00b0"
},
{
"code": "13",
"type": "245x648",
"x": "1994.5",
"y": 0,
"center": "1146.5",
"w": "648",
"h": "245",
"angle": "0\u00b0"
},
{
"code": "14",
"type": "247x247",
"x": "2589.5",
"y": 0,
"center": "1550.5",
"w": "247",
"h": "247",
"angle": "0\u00b0"
},
{
"code": "15",
"type": "246x247",
"x": "2998.5",
"y": 0,
"center": "1757",
"w": "247",
"h": "246",
"angle": "0\u00b0"
},
{
"code": "16",
"type": "398x392",
"x": "1799.5",
"y": 0,
"center": "1955",
"w": "392",
"h": "398",
"angle": "0\u00b0"
},
{
"code": "17",
"type": "300x293",
"x": "2394.5",
"y": 0,
"center": "2147",
"w": "293",
"h": "300",
"angle": "0\u00b0"
},
{
"code": "18",
"type": "298x297",
"x": "3001.5",
"y": 0,
"center": "2144",
"w": "297",
"h": "298",
"angle": "0\u00b0"
},
{
"code": "19",
"type": "245x1447",
"x": "4191.5",
"y": 0,
"center": "344.5",
"w": "1447",
"h": "245",
"angle": "0\u00b0"
},
{
"code": "20",
"type": "295x300",
"x": "4175.0",
"y": 0,
"center": "743.5",
"w": "300",
"h": "295",
"angle": "0\u00b0"
},
{
"code": "21",
"type": "498x495",
"x": "4897.5",
"y": 0,
"center": "1030",
"w": "495",
"h": "498",
"angle": "0\u00b0"
},
{
"code": "22",
"type": "245x648",
"x": "3977.0",
"y": 0,
"center": "1150.5",
"w": "648",
"h": "245",
"angle": "0\u00b0"
},
{
"code": "23",
"type": "245x246",
"x": "4547.5",
"y": 0,
"center": "1541.5",
"w": "246",
"h": "245",
"angle": "0\u00b0"
},
{
"code": "24",
"type": "245x245",
"x": "4992.5",
"y": 0,
"center": "1735.5",
"w": "245",
"h": "245",
"angle": "0\u00b0"
},
{
"code": "25",
"type": "398x392",
"x": "3796.5",
"y": 0,
"center": "1955",
"w": "392",
"h": "398",
"angle": "0\u00b0"
},
{
"code": "26",
"type": "298x296",
"x": "4392.5",
"y": 0,
"center": "2142",
"w": "296",
"h": "298",
"angle": "0\u00b0"
},
{
"code": "27",
"type": "297x295",
"x": "4991.5",
"y": 0,
"center": "2146.5",
"w": "295",
"h": "297",
"angle": "0\u00b0"
}
]
[{"code": 1, "type": "250x1450", "x": 945, "y": 0, "center": 351, "w": 1450, "h": 250, "angle": "0"}, {"code": 2, "type": "300x300", "x": 923, "y": 0, "center": 754, "w": 300, "h": 300, "angle": "0"}, {"code": 3, "type": "501x500", "x": 1638, "y": 0, "center": 1054, "w": 500, "h": 501, "angle": "0"}, {"code": 4, "type": "250x648", "x": 717, "y": 0, "center": 1149, "w": 648, "h": 250, "angle": "0"}, {"code": 5, "type": "250x250", "x": 1337, "y": 0, "center": 1543, "w": 250, "h": 250, "angle": "0"}, {"code": 6, "type": "249x249", "x": 1780, "y": 0, "center": 1750, "w": 249, "h": 249, "angle": "0"}, {"code": 7, "type": "400x399", "x": 549, "y": 0, "center": 1955, "w": 399, "h": 400, "angle": "0"}, {"code": 8, "type": "300x302", "x": 1143, "y": 0, "center": 2159, "w": 302, "h": 300, "angle": "0"}, {"code": 9, "type": "300x302", "x": 1745, "y": 0, "center": 2157, "w": 302, "h": 300, "angle": "0"}, {"code": 10, "type": "248x1447", "x": 2939, "y": 0, "center": 345, "w": 1447, "h": 248, "angle": "0"}, {"code": 11, "type": "298x297", "x": 2947, "y": 0, "center": 747, "w": 297, "h": 298, "angle": "0"}, {"code": 12, "type": "499x499", "x": 3640, "y": 0, "center": 1040, "w": 499, "h": 499, "angle": "0"}, {"code": 13, "type": "245x648", "x": 2743, "y": 0, "center": 1146, "w": 648, "h": 245, "angle": "0"}, {"code": 14, "type": "247x247", "x": 3338, "y": 0, "center": 1550, "w": 247, "h": 247, "angle": "0"}, {"code": 15, "type": "246x247", "x": 3747, "y": 0, "center": 1757, "w": 247, "h": 246, "angle": "0"}, {"code": 16, "type": "398x392", "x": 2548, "y": 0, "center": 1955, "w": 392, "h": 398, "angle": "0"}, {"code": 17, "type": "300x293", "x": 3143, "y": 0, "center": 2147, "w": 293, "h": 300, "angle": "0"}, {"code": 18, "type": "298x297", "x": 3750, "y": 0, "center": 2144, "w": 297, "h": 298, "angle": "0"}, {"code": 19, "type": "245x1447", "x": 4940, "y": 0, "center": 344, "w": 1447, "h": 245, "angle": "0"}, {"code": 20, "type": "295x300", "x": 4924, "y": 0, "center": 743, "w": 300, "h": 295, "angle": "0"}, {"code": 21, "type": "498x495", "x": 5646, "y": 0, "center": 1030, "w": 495, "h": 498, "angle": "0"}, {"code": 22, "type": "245x648", "x": 4726, "y": 0, "center": 1150, "w": 648, "h": 245, "angle": "0"}, {"code": 23, "type": "245x246", "x": 5296, "y": 0, "center": 1541, "w": 246, "h": 245, "angle": "0"}, {"code": 24, "type": "245x245", "x": 5741, "y": 0, "center": 1735, "w": 245, "h": 245, "angle": "0"}, {"code": 25, "type": "398x392", "x": 4545, "y": 0, "center": 1955, "w": 392, "h": 398, "angle": "0"}, {"code": 26, "type": "298x296", "x": 5141, "y": 0, "center": 2142, "w": 296, "h": 298, "angle": "0"}, {"code": 27, "type": "297x295", "x": 5740, "y": 0, "center": 2146, "w": 295, "h": 297, "angle": "0"}]

View File

@ -38,11 +38,11 @@ cloud_need_points_size = 600000
save_cload = true
[sys]
fake = false
fake = true
camera_cap_fake = true
lidar_cap_fake = true
npu_fake = true
conners_detect_fake = false
fake_image_fpath = ./result/test_1/ep_100000_count_600000/output.jpg
fake_lidar_fpath = ./result/test_1/ep_100000_count_600000/output.ply
conners_detect_fake = true
fake_image_fpath = ./result/hy_1/output.jpg
fake_lidar_fpath = ./result/hy_1/output.ply

View File

@ -182,6 +182,7 @@ def init_image_framework_sdk():
# 加载C++库
current_file_dir = os.path.dirname(os.path.abspath(__file__))
image_framework_sdk = CDLL(os.path.join(current_file_dir, f'./image_framework.dll'))
print(f"[image_framework_sdk] ====== [{image_framework_sdk}]")
print("Load Image framework sdk success")
except Exception as e:
print(f"Load Image framework sdk failed: {str(e)}")
@ -236,7 +237,7 @@ if __name__ == '__main__':
raise RuntimeError(f"设置回调函数始设置失败, 错误码: {ret}")
dataPath = "./result/hy_1" # 数据路径
dataPath = "./result" # 数据路径
data_img_path = None # 检测的图片路径
data_detect_res_save_path = None # 检测结果的保存路径
# 遍历目录

View File

@ -22,12 +22,18 @@ x_min, x_max = float('inf'), float('-inf')
y_min, y_max = float('inf'), float('-inf')
x_max_original = 0
x_center_max = 0 # 在右测坐标系中。所有预埋件中心点的x坐标最大的值
x_center_max_w = 0
x_center_max_h = 0
for index, row in df.iloc[2:30].iterrows():
original_x = row[col('K')] - row[col('D')] / 2
if(original_x > x_max_original):
x_max_original = original_x
original_x_center = row[col('K')]
if(original_x_center > x_center_max):
x_center_max = original_x_center
x_center_max_w = row[col('D')]
x_center_max_h = row[col('E')]
print(f"x_center_max_original={x_center_max}")
# 以为预埋件中心点的x最大的矩形的左下角作为坐标原点
x_center_max_left_bottom = x_center_max + x_center_max_w / 2
bm_struct_array = []
@ -35,14 +41,22 @@ for index, row in df.iloc[2:30].iterrows():
# 打印B列和C列的值
print(f"{index+2} -> A列-编号: {row[col('A')]}, D列-测量宽度: {row[col('D')]}, E列-测量高度: {row[col('E')]}K列-测量中心x: {row[col('K')]}, L列-测量中心y: {row[col('L')]}")
# 转换x坐标
x_original = row[col('K')]
x = x_max_original - x_original - row[col('D')] / 2
y = row[col('L')] - row[col('E')] / 2
# 转换中心点坐标
center_x = x_max_original - x_original
# 使用新的中心点之后x坐标需要转换
x_center_original = row[col('K')]
center_x =(-x_center_original) + x_center_max_left_bottom + 350
# center_x = -x_center_original
center_y = row[col('L')]
width = row[col('D')]
height = row[col('E')]
# 左上角
x = center_x - width / 2
# 左上角
y = center_y + height / 2
# 左下角
x_left_bottom = center_x - width / 2
# 左下角
y_left_bottom = center_y - height / 2
# [{
# "code": "PT001",
@ -55,27 +69,21 @@ for index, row in df.iloc[2:30].iterrows():
# "angle": "90\""
# },
bm_struct_array.append({
"code": str(row[col('A')]),
"type": f"{str(row[col('E')])}x{str(row[col('D')])}",# w x h
"x": str(center_x),
"code": int(row[col('A')]),
"type": f"{height}x{width}",# h x w
"x": int(center_x),
"y": 0,
"center": str(center_y),
"w": str(row[col('D')]),
"h": str(row[col('E')]),
"angle" : "0°"
"center": int(center_y),
"w":width,
"h": height,
"angle" : "0"
})
# 画出中心点
ax.scatter(center_x, center_y, color='red', marker='o', s=10)
# 更新边界
x_min = min(x_min, x)
x_max = max(x_max, x + row[col('D')])
y_min = min(y_min, y)
y_max = max(y_max, y + row[col('E')])
# 绘制矩形
rect = Rectangle((x, y), row[col('D')], row[col('E')], linewidth=1, edgecolor='r', facecolor='none')
rect = Rectangle((x_left_bottom, y_left_bottom),width, height, linewidth=1, edgecolor='r', facecolor='none')
ax.add_patch(rect)
# 在矩形中心绘制编号A列
@ -87,21 +95,21 @@ for index, row in df.iloc[2:30].iterrows():
# 在矩形上边绘制宽度D列
ax.text(
x + row[col('D')] / 2, y + row[col('E')], str(row[col('D')]),
x + row[col('D')] / 2, y_left_bottom + row[col('E')], str(row[col('D')]),
ha='center', va='bottom',
fontsize=6, color='green' # 宽度字体大小为10颜色为绿色
)
# 在矩形右边绘制高度E列
ax.text(
x + row[col('D')], y + row[col('E')] / 2, str(row[col('E')]),
x + width, y_left_bottom + height / 2, height,
ha='left', va='center',
fontsize=6, color='red' # 高度字体大小为10颜色为红色
)
# 设置坐标轴的范围外扩100左右
ax.set_xlim(x_min, x_max ) # 留出一些边距
ax.set_ylim(y_min, y_max ) # 留出一些边距
# 设置坐标轴的范围
# ax.set_xlim(x_min, x_max ) # 留出一些边距
# ax.set_ylim(y_min, y_max ) # 留出一些边距
# 设置坐标轴的比例
ax.set_aspect('equal')

BIN
image_framework_33.dll Normal file

Binary file not shown.

View File

@ -1,27 +1,27 @@
[(4366.0, 226.0), (5816.0, 226.0), (5816.0, 476.0), (4366.0, 476.0)]
[(4963.0, 604.0), (5263.0, 604.0), (5263.0, 904.0), (4963.0, 904.0)]
[(4147.5, 804.0), (4647.5, 804.0), (4647.5, 1305.0), (4147.5, 1305.0)]
[(4995.0, 1024.0), (5643.0, 1024.0), (5643.0, 1274.0), (4995.0, 1274.0)]
[(4574.0, 1418.0), (4824.0, 1418.0), (4824.0, 1668.0), (4574.0, 1668.0)]
[(4131.0, 1626.0), (4380.0, 1626.0), (4380.0, 1875.0), (4131.0, 1875.0)]
[(5287.0, 1755.0), (5686.0, 1755.0), (5686.0, 2155.0), (5287.0, 2155.0)]
[(4742.0, 2009.0), (5044.0, 2009.0), (5044.0, 2309.0), (4742.0, 2309.0)]
[(4140.0, 2007.0), (4442.0, 2007.0), (4442.0, 2307.0), (4140.0, 2307.0)]
[(2373.5, 221.0), (3820.5, 221.0), (3820.5, 469.0), (2373.5, 469.0)]
[(2940.0, 598.0), (3237.0, 598.0), (3237.0, 896.0), (2940.0, 896.0)]
[(2146.5, 791.0), (2645.5, 791.0), (2645.5, 1290.0), (2146.5, 1290.0)]
[(2968.5, 1024.0), (3616.5, 1024.0), (3616.5, 1269.0), (2968.5, 1269.0)]
[(2574.0, 1427.0), (2821.0, 1427.0), (2821.0, 1674.0), (2574.0, 1674.0)]
[(2165.0, 1634.0), (2412.0, 1634.0), (2412.0, 1880.0), (2165.0, 1880.0)]
[(3291.5, 1756.0), (3683.5, 1756.0), (3683.5, 2154.0), (3291.5, 2154.0)]
[(2746.0, 1997.0), (3039.0, 1997.0), (3039.0, 2297.0), (2746.0, 2297.0)]
[(2137.0, 1995.0), (2434.0, 1995.0), (2434.0, 2293.0), (2137.0, 2293.0)]
[(372.0, 222.0), (1819.0, 222.0), (1819.0, 467.0), (372.0, 467.0)]
[(962.0, 596.0), (1262.0, 596.0), (1262.0, 891.0), (962.0, 891.0)]
[(142.0, 781.0), (637.0, 781.0), (637.0, 1279.0), (142.0, 1279.0)]
[(986.0, 1028.0), (1634.0, 1028.0), (1634.0, 1273.0), (986.0, 1273.0)]
[(616.5, 1419.0), (862.5, 1419.0), (862.5, 1664.0), (616.5, 1664.0)]
[(172.0, 1613.0), (417.0, 1613.0), (417.0, 1858.0), (172.0, 1858.0)]
[(1294.5, 1756.0), (1686.5, 1756.0), (1686.5, 2154.0), (1294.5, 2154.0)]
[(746.5, 1993.0), (1042.5, 1993.0), (1042.5, 2291.0), (746.5, 2291.0)]
[(148.0, 1998.0), (443.0, 1998.0), (443.0, 2295.0), (148.0, 2295.0)]
[[4366.0, 226.0], [5816.0, 226.0], [5816.0, 476.0], [4366.0, 476.0]]
[[4963.0, 604.0], [5263.0, 604.0], [5263.0, 904.0], [4963.0, 904.0]]
[[4147.5, 804.0], [4647.5, 804.0], [4647.5, 1305.0], [4147.5, 1305.0]]
[[4995.0, 1024.0], [5643.0, 1024.0], [5643.0, 1274.0], [4995.0, 1274.0]]
[[4574.0, 1418.0], [4824.0, 1418.0], [4824.0, 1668.0], [4574.0, 1668.0]]
[[4131.0, 1626.0], [4380.0, 1626.0], [4380.0, 1875.0], [4131.0, 1875.0]]
[[5287.0, 1755.0], [5686.0, 1755.0], [5686.0, 2155.0], [5287.0, 2155.0]]
[[4742.0, 2009.0], [5044.0, 2009.0], [5044.0, 2309.0], [4742.0, 2309.0]]
[[4140.0, 2007.0], [4442.0, 2007.0], [4442.0, 2307.0], [4140.0, 2307.0]]
[[2373.5, 221.0], [3820.5, 221.0], [3820.5, 469.0], [2373.5, 469.0]]
[[2940.0, 598.0], [3237.0, 598.0], [3237.0, 896.0], [2940.0, 896.0]]
[[2146.5, 791.0], [2645.5, 791.0], [2645.5, 1290.0], [2146.5, 1290.0]]
[[2968.5, 1024.0], [3616.5, 1024.0], [3616.5, 1269.0], [2968.5, 1269.0]]
[[2574.0, 1427.0], [2821.0, 1427.0], [2821.0, 1674.0], [2574.0, 1674.0]]
[[2165.0, 1634.0], [2412.0, 1634.0], [2412.0, 1880.0], [2165.0, 1880.0]]
[[3291.5, 1756.0], [3683.5, 1756.0], [3683.5, 2154.0], [3291.5, 2154.0]]
[[2746.0, 1997.0], [3039.0, 1997.0], [3039.0, 2297.0], [2746.0, 2297.0]]
[[2137.0, 1995.0], [2434.0, 1995.0], [2434.0, 2293.0], [2137.0, 2293.0]]
[[372.0, 222.0], [1819.0, 222.0], [1819.0, 467.0], [372.0, 467.0]]
[[962.0, 596.0], [1262.0, 596.0], [1262.0, 891.0], [962.0, 891.0]]
[[142.0, 781.0], [637.0, 781.0], [637.0, 1279.0], [142.0, 1279.0]]
[[986.0, 1028.0], [1634.0, 1028.0], [1634.0, 1273.0], [986.0, 1273.0]]
[[616.5, 1419.0], [862.5, 1419.0], [862.5, 1664.0], [616.5, 1664.0]]
[[172.0, 1613.0], [417.0, 1613.0], [417.0, 1858.0], [172.0, 1858.0]]
[[1294.5, 1756.0], [1686.5, 1756.0], [1686.5, 2154.0], [1294.5, 2154.0]]
[[746.5, 1993.0], [1042.5, 1993.0], [1042.5, 2291.0], [746.5, 2291.0]]
[[148.0, 1998.0], [443.0, 1998.0], [443.0, 2295.0], [148.0, 2295.0]]

View File

@ -1,7 +1 @@
```pycon
self.image_framework = ImageFramework()
self.image_framework.signals.on_image_detect_result.connect(
lambda data: self.image_result(data))
self.image_framework.configure()
self.image_framework.start()
```
conda env create -f environment.yaml

BIN
result/hy_1/output.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

BIN
result/hy_1/output.ply Normal file

Binary file not shown.

BIN
result/hy_1/result.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
result/hy_1/result2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

View File

@ -0,0 +1,64 @@
6911
3175
7935
3175
7935
4142
6911
4142
5578
3808
6623
3808
6623
4761
5578
4761
2677
5089
5214
5089
5214
6179
2677
6179
2613
2198
4142
2198
4142
3607
2613
3607
73
1746
1314
1746
1314
2799
73
2799
52
3066
1092
3066
1092
3997
52
3997
4815
1805
5951
1805
5951
2849
4815
2849
6774
1829
7896
1829
7896
2869
6774
2869

View File

@ -1,24 +1,64 @@
1131
2007
5900
2007
5900
5376
1131
5376
2004
2958
3142
2958
3142
3948
2004
3948
3887
2919
4839
2919
4839
3902
3887
3902
6911
3175
7935
3175
7935
4142
6911
4142
5578
3808
6623
3808
6623
4761
5578
4761
2677
5089
5214
5089
5214
6179
2677
6179
2613
2198
4142
2198
4142
3607
2613
3607
73
1746
1314
1746
1314
2799
73
2799
52
3066
1092
3066
1092
3997
52
3997
4815
1805
5951
1805
5951
2849
4815
2849
6774
1829
7896
1829
7896
2869
6774
2869