使用<template>
<div class="gallery" v-if="pictures">
<a v-for="(picture, index) in pictures" :key="index" class="gallery__item" :href="picture.path" data-lightbox="gallery" :data-title="picture.title">
<div class="gallery__image">
<img :src="picture.path">
</div>
<div class="gallery__description" v-if="options.showDescription">{{ picture.title }}</div>
</a>
</div>
</template>
<script>
export default {
name: 'AppGallery',
props: {
pictures: {
type: Array,
required: true,
},
options: {
type: Object,
required: false,
default() {
return {
showDescription: true,
};
},
},
},
mounted() {
//lightbox.build();
},
};
</script>
,我可以找到图像中文本的轮廓。我想删除上述文字,并用周围区域的平均像素替换。
但是,轮廓线比我想要的要小一些,导致边缘模糊,人们几乎无法分辨出原始文本是什么:
我曾经偶然遇到过一个cv2
教程,其中带有风格化的“ j”作为示例图像。它显示了如何以类似于在遮罩中每个预先存在的正样本旁边添加正样本的方式“扩展”轮廓。
如果cv2
中尚不存在这种方法,我该如何手动执行此操作?
答案 0 :(得分:0)
我寻求的功能是扩张,详情如下:
import cv2
import numpy as np
img = cv2.imread('j.png',0)
kernel = np.ones((5,5),np.uint8)
dilation = cv2.dilate(img,kernel,iterations = 1)