我该如何填补因细化而出现的空白?第一个图像是稀疏之前的图像,第二个图像是稀疏之后的图像,第三个是我需要连接的像素的示例。我正在使用MATLAB R2013a。
我在稀疏中使用了以下代码:
rows, err := db.Queryx(`SELECT
category.id, category.parentId, category.name, category.createdAt, category.updatedAt,
item.id, item.categoryId, item.name, item.createdAt, item.updatedAt
FROM category
LEFT JOIN item ON item.categoryId=category.id
ORDER BY category.id ASC`)
if err != nil {
return nil, errors.Wrap(err, "Failed to exec category select with items")
}
results := []*CategoryWithItems{}
var prevID int64
var c *CategoryWithItems
for rows.Next() {
row, err := rows.SliceScan()
if err != nil {
return nil, errors.Wrap(err, "Failed to execute SliceScan")
}
categoryID := row[0].(int64)
if prevID == 0 || categoryID != prevID {
c = &CategoryWithItems{
Category:Category{
ID: categoryID,
ParentID: row[1].(int64),
Name: string(row[2].([]uint8)),
CreatedAt: row[3].(time.Time),
UpdatedAt: row[4].(time.Time),
},
Items: []*Item{},
}
results = append(results, c)
prevID = categoryID
}
if row[5] != nil {
i := &Item{
ID: row[5].(int64),
CategoryID: row[6].(int64),
Name: string(row[7].([]uint8)),
CreatedAt: row[8].(time.Time),
UpdatedAt: row[9].(time.Time),
}
c.Items = append(c.Items, i)
}
}
细化前的图像:
细化后的图像:
我需要连接的示例:
当我使用bw_clean = imopen(binary_image, strel('rectangle',[3 3]));
bw_clean = bwareaopen(bw_clean, 15);
thin_image = ~bwmorph(imcomplement(bw_clean), 'thin', Inf);
时,输出为:
当我使用
BW2 = imfill(A,'holes');
输出为: