提取艺术二维码素材

创建:xiaozi · 最后修改:xiaozi 2020-05-30 11:43 ·

二维码原理

艺术二维码

拼图的pattern可以有两种做法

拆解9thws二维素材

分割素材

def has_intersect(box1, box2):
    left = max(box1[0], box2[0])
    top = max(box1[1], box2[1])
    right = min(box2[0] + box2[2], box1[0] + box1[2])
    bottom = min(box1[1] + box1[3], box2[1] + box2[3])
    # return left <= right and top <= bottom
    return left < right and top < bottom

def merge_bounding_box(box1, box2):
    left = min(box1[0], box2[0])
    top = min(box1[1], box2[1])
    right = max(box1[0] + box1[2], box2[0] + box2[2])
    bottom = max(box1[1] + box1[3], box2[1] + box2[3])
    return (left, top, right - left, bottom - top)

# todo add merge logic

def expand_to_grid(box):
    grid_size = 50
    left = box[0] // grid_size * grid_size
    top = box[1] // grid_size * grid_size
    bottom = math.ceil((box[1] + box[3]) / grid_size) * grid_size
    right = math.ceil((box[0] + box[2]) / grid_size) * grid_size
    return (left, top, right - left, bottom - top)

素材去重

裁完图之后,我们需要对图片去重,这些图片看上去是重复的,但细细观察的话,其实每张图片都不是完全一样的,图片上有随机的噪点,这样没有办法去比对每个像素点来判断是不是一样的图片了;这边需要引入2个算法 ssimmsessim 是对图片结构进行比较的算法,mse是对图片颜色进行比较的算法。


生成Pattern


领域模型

效果展示


浏览 317 次 · 下载PDF

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.128.0. UTC+08:00, 2024-06-16 08:35
浙ICP备14020137号-1 $访客地图$