Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3103|回复: 4

斯俊凯:基于图像处理的图形重绘系统

[复制链接]

2

主题

9

帖子

116

积分

注册会员

Rank: 2

积分
116
发表于 2023-5-6 23:10:38 | 显示全部楼层 |阅读模式
基于图像处理的图形重绘系统
回复

使用道具 举报

399

主题

1251

帖子

4020

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4020
发表于 2023-12-28 16:21:52 | 显示全部楼层
1.学习文字识别http://eli-home.top/discuz/forum ... =587&extra=page%3D1,只需要能运行,知道怎么用就行
1.4-1.9
2.学习识别直线(霍夫变换算法)https://blog.csdn.net/weixin_51658186/article/details/130370996,也可以进行圆的识别
1.9-2.15
3.对图形进行分割并分类(文字还是图形)2.15-3.15
4.重绘图形,变为指定矢量图片(需要学习常用矢量图形的格式)3.15-4.15
回复

使用道具 举报

2

主题

9

帖子

116

积分

注册会员

Rank: 2

积分
116
 楼主| 发表于 2024-4-24 16:24:06 | 显示全部楼层
目前进展:利用霍夫变换实现直线识别和圆的识别,文字的识别独立的程序实现
下一步的计划:将程序结合起来能够同时识别直线圆和文字
遇到的问题:识别结果有遗漏,不能完整识别出图像里的所有元素
回复

使用道具 举报

2

主题

9

帖子

116

积分

注册会员

Rank: 2

积分
116
 楼主| 发表于 2024-5-7 19:45:43 | 显示全部楼层
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread('E:/pythonpictures/5.jpg', 0)
img = cv.medianBlur(img, 5)
cimg = cv.cvtColor(img, cv.COLOR_GRAY2BGR)
circles = cv.HoughCircles(img, cv.HOUGH_GRADIENT, 1, minDist=30, param1=100, param2=50, minRadius=0, maxRadius=200)
print('circles1:', circles)
circles = np.uint16(np.around(circles))
print('circles2:', circles)

for i in circles[0, :]:
    # draw the outer circle
    cv.circle(cimg, (i[0], i[1]), i[2], (0, 255, 0), 2)
    # draw the center of the circle
    cv.circle(cimg, (i[0], i[1]), 2, (0, 0, 255), 3)
    plt.figure(figsize=(10, 8), dpi=100)
    plt.imshow(cimg[:, :, ::-1])
    plt.xticks([]), plt.yticks([])
    plt.show()
霍夫变换圆识别程序
回复

使用道具 举报

2

主题

9

帖子

116

积分

注册会员

Rank: 2

积分
116
 楼主| 发表于 2024-5-7 19:46:00 | 显示全部楼层
import cv2
import numpy as np

def img_transform():
    img = cv2.imread('E:/pythonpictures/5.jpg')  # 图像尺寸为(610,610)
    img2 = img.copy()  # 复制一个图像用于对比
    canny = cv2.Canny(img, 50, 100)  # 二值化图像

    lines2 = cv2.HoughLinesP(canny, 1, np.pi/180, 200, lines=None, minLineLength=100, maxLineGap=20)  # PPHT

    for i in range(0, len(lines2)):
        x1, y1, x2, y2 = lines2[0][0], lines2[0][1], lines2[0][2], lines2[0][3]

        cv2.line(img2, (x1, y1), (x2, y2), (0, 0, 255), 2)  # 在原图的副本img2中画出所有这些线条

    result2 = np.hstack((img, img2))
    cv2.namedWindow('result', 0)
    cv2.imshow('result', result2)
    cv2.waitKey(0)

if __name__ == '__main__':
    img_transform()
霍夫变换线段程序
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|DiscuzX

GMT+8, 2025-6-8 07:03 , Processed in 0.036260 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表