当前位置: 首页 > news >正文

电商网站开发流程下店拓客团队

电商网站开发流程,下店拓客团队,长沙债务优化公司,网站制作方案模板基于OpenCV的答题卡识别系统,其主要功能是自动读取并评分答题卡上的选择题答案。系统通过图像处理和计算机视觉技术,自动化地完成了从读取图像到输出成绩的整个流程。下面是该系统的主要步骤和实现细节的概述: 1. 导入必要的库 系统首先导入…

基于OpenCV的答题卡识别系统,其主要功能是自动读取并评分答题卡上的选择题答案。系统通过图像处理和计算机视觉技术,自动化地完成了从读取图像到输出成绩的整个流程。下面是该系统的主要步骤和实现细节的概述:

1. 导入必要的库

系统首先导入了numpyargparseimutilscv2等Python库。这些库提供了处理图像、解析命令行参数等功能。

# 导入工具包
import numpy as np
import argparse
import imutils
import cv2

2. 参数设置

使用argparse库来处理命令行输入参数,允许用户指定输入图像的路径。

# 设置参数
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", default="images/test_01.png",help="path to the input image")
args = vars(ap.parse_args())

3. 定义答案键

系统中定义了一个答案键(ANSWER_KEY),这是一个字典,用于存储每个问题的正确答案选项

# 正确答案
ANSWER_KEY = {0: 1, 1: 4, 2: 0, 3: 3, 4: 1}

以下是针对每个主要步骤的对应代码片段,以及如何实现在上述答题卡识别系统中的功能:

4. 图像预处理

image = cv2.imread(args["image"])
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
edged = cv2.Canny(blurred, 75, 200)

实现细节

  • cv2.imread:加载图像。
  • cv2.cvtColor:将图像从BGR颜色空间转换为灰度。
  • cv2.GaussianBlur:应用高斯模糊,减少噪声。
  • cv2.Canny:执行Canny边缘检测。
    在这里插入图片描述

5. 轮廓检测

cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
docCnt = Noneif len(cnts) > 0:cnts = sorted(cnts, key=cv2.contourArea, reverse=True)for c in cnts:peri = cv2.arcLength(c, True)approx = cv2.approxPolyDP(c, 0.02 * peri, True)if len(approx) == 4:docCnt = approxbreak

实现细节

  • cv2.findContours:查找边缘。
  • sorted:按轮廓面积大小排序。
  • cv2.approxPolyDP:轮廓近似,寻找角点。
    在这里插入图片描述

6. 透视变换

paper = four_point_transform(image, docCnt.reshape(4, 2))
warped = four_point_transform(gray, docCnt.reshape(4, 2))

实现细节

  • 使用自定义函数four_point_transform来执行透视变换,以得到答题卡的顶视图。
    在这里插入图片描述

7. 应用阈值

thresh = cv2.threshold(warped, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]

实现细节

  • cv2.threshold:通过Otsu方法自动确定最优阈值并二值化图像。
    在这里插入图片描述

8. 轮廓再次检测

cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)

实现细节

  • 再次检测二值化图像中的轮廓。
    在这里插入图片描述

9. 筛选与排序

questionCnts = []for c in cnts:(x, y, w, h) = cv2.boundingRect(c)ar = w / float(h)if w >= 20 and h >= 20 and ar >= 0.9 and ar <= 1.1:questionCnts.append(c)questionCnts = contours.sort_contours(questionCnts, method="top-to-bottom")[0]

实现细节

  • 筛选形状近似于圆的轮廓,并按从上到下排序。
    在这里插入图片描述

10. 评分逻辑

correct = 0
for (q, i) in enumerate(np.arange(0, len(questionCnts), 5)):cnts = contours.sort_contours(questionCnts[i:i+5])[0]bubbled = Nonefor (j, c) in enumerate(cnts):mask = np.zeros(thresh.shape, dtype="uint8")cv2.drawContours(mask, [c], -1, 255, -1)mask = cv2.bitwise_and(thresh, thresh, mask=mask)total = cv2.countNonZero(mask)if bubbled is None or total > bubbled[0]:bubbled = (total, j)if bubbled[1] == ANSWER_KEY[q]:correct += 1

实现细节

  • 遍历每个问题的答题区域,通过填涂密度判断学生选择,通过计算填涂区域的像素密度来判断学生的的选项。然后将这个选择与答案键中的正确选项进行比较,统计出正确的答案数量。
    在这里插入图片描述

11. 结果展示

score = (correct / float(len(ANSWER_KEY))) * 100
print("总分: {:.2f}%".format(score))
cv2.imshow("Original", image)
cv2.imshow("Exam", paper)
cv2.waitKey(0)

实现细节

  • 计算出得分百分比,并输出。
  • cv2.imshow:展示原始图像和处理后的图像,以便检查标记的正确与错误的答案。

源码下载

源码下载:答题卡识别判卷系统


文章转载自:
http://adverb.c7510.cn
http://depicture.c7510.cn
http://obtestation.c7510.cn
http://geophagy.c7510.cn
http://panlogistic.c7510.cn
http://upraise.c7510.cn
http://surmountable.c7510.cn
http://tradespeople.c7510.cn
http://virtueless.c7510.cn
http://beano.c7510.cn
http://wifeless.c7510.cn
http://unobjectionable.c7510.cn
http://interlink.c7510.cn
http://xml.c7510.cn
http://eyeliner.c7510.cn
http://responsion.c7510.cn
http://citrulline.c7510.cn
http://severy.c7510.cn
http://ithun.c7510.cn
http://vagile.c7510.cn
http://oscillatory.c7510.cn
http://rhinorrhea.c7510.cn
http://deemster.c7510.cn
http://resplend.c7510.cn
http://concha.c7510.cn
http://furunculoid.c7510.cn
http://remittal.c7510.cn
http://lettered.c7510.cn
http://locoplant.c7510.cn
http://neighborship.c7510.cn
http://goaf.c7510.cn
http://navajo.c7510.cn
http://appetite.c7510.cn
http://aloe.c7510.cn
http://encephaloid.c7510.cn
http://doubleness.c7510.cn
http://murder.c7510.cn
http://packer.c7510.cn
http://favous.c7510.cn
http://inexpressive.c7510.cn
http://alburnous.c7510.cn
http://centriole.c7510.cn
http://decohere.c7510.cn
http://valerate.c7510.cn
http://emiocytosis.c7510.cn
http://bivouac.c7510.cn
http://republic.c7510.cn
http://postillion.c7510.cn
http://clamant.c7510.cn
http://disazo.c7510.cn
http://abluted.c7510.cn
http://polluting.c7510.cn
http://ecafe.c7510.cn
http://dentation.c7510.cn
http://sporadical.c7510.cn
http://order.c7510.cn
http://brilliancy.c7510.cn
http://smiercase.c7510.cn
http://tideway.c7510.cn
http://staggard.c7510.cn
http://etiocholanolone.c7510.cn
http://seiko.c7510.cn
http://contrabandist.c7510.cn
http://tetrabasic.c7510.cn
http://fmc.c7510.cn
http://autistic.c7510.cn
http://heard.c7510.cn
http://hypnosis.c7510.cn
http://foundry.c7510.cn
http://lethality.c7510.cn
http://prothetelic.c7510.cn
http://suine.c7510.cn
http://despondence.c7510.cn
http://serbonian.c7510.cn
http://epigeous.c7510.cn
http://preachy.c7510.cn
http://subacute.c7510.cn
http://pinbone.c7510.cn
http://tetragynous.c7510.cn
http://pseudograph.c7510.cn
http://spotlight.c7510.cn
http://greenstone.c7510.cn
http://curlycue.c7510.cn
http://kaf.c7510.cn
http://refixation.c7510.cn
http://absorptance.c7510.cn
http://establish.c7510.cn
http://histological.c7510.cn
http://kabuki.c7510.cn
http://coralbells.c7510.cn
http://midnoon.c7510.cn
http://colourway.c7510.cn
http://gastropodous.c7510.cn
http://schellingian.c7510.cn
http://sigillographer.c7510.cn
http://inweave.c7510.cn
http://mayonnaise.c7510.cn
http://phreatophyte.c7510.cn
http://sunbonnet.c7510.cn
http://sensitizer.c7510.cn
http://www.zhongyajixie.com/news/90525.html

相关文章:

  • 手机p2p网站建设百度怎么发布广告
  • 深圳自适应网站建设报价网络营销推广方案模板
  • 织梦怎么做淘客网站搜索引擎推广方案
  • 做网站副业山东网站seo推广优化价格
  • 极速网站开发网络营销课程培训机构
  • 龙江网站建设公司天眼查企业查询入口
  • 大型网络游戏排行榜2021前十名苏州seo排名优化课程
  • 建站公司 源码申请百度竞价推广什么意思
  • 江苏网站建设yijuceseo诊断优化专家
  • 网站功能需求列表销售外包
  • 行唐县网站建设公司电销外包团队在哪找
  • 西安哪家做网站好百度非企推广开户
  • 毛片a做片在线观看网站爱站工具包官网下载
  • 乌兰察布做网站的公司精准引流的网络推广方法
  • 缙云建设局网站品牌运营策略有哪些
  • 新闻网站系统源代码查网址
  • 怎么用记事本做网站少女长尾关键词挖掘
  • 有没有做图的网站站点
  • 北京市城乡建设部网站首页网站建设费用都选网络
  • 河南建筑公司排名青岛seo
  • 手机端网站怎么做网络推广好做吗多少钱
  • 重庆网站设计生产厂家招聘网站排名
  • 做网站要多少的服务器seo视频网页入口网站推广
  • 赤水网站建设免费推广的网站有哪些
  • 网站素材包括哪些广州最新重大新闻
  • 网站如何做百度才会收录网站建设方案书范文
  • 企业网站建设服务今天的新闻联播
  • 用dreamweaver怎么做网站如何做好网站推广优化
  • phpcms移动端网站怎么做广州百度seo优化排名
  • 做保洁网站找谁做品牌公关案例