摘要
在电影院的票务系统中,一般分为线上售票和线下售票两种方式。目前线上售票有成熟的软件工具,用户可以通过手机或电脑在线上自动选择各种类型的座位信息。但在线下售票中,操作人员只能通过人工观察票务系统软件的屏幕界面,人工获取某个场次的不同类型的空余座位信息,然后再手工输入空余的座位信息到出票系统,打印纸质电影票后,然后进行售票。针对线下售票需要人工操作这种不方便不快捷的情况,作者利用C++语言,基于OpenCV图像处理库,首先快速读取票务系统软件的界面图片的彩色图像,将三通道的彩色图像转化为单通道的灰度图像。利用findContours()函数获取图像的轮廓集,处理掉缺失和过小的轮廓后,通过外接矩形来获取轮廓的位置,将轮廓和外接矩形作为属性初始化对应的每个座位的实例化对象。通过读取各个对象的矩形内的像素点信息,可以确定对象的颜色以及位置。实现了对屏幕中各种不同类型的座位信息的自动识别与定位,准确率为100%;然后,自动输入到出票系统,自动打印出纸质电影票,达到了自动线下售票的目的。开发此系统使用的技术方法,对于需要识别第三方软件界面的屏幕信息及其变化的场景,如:监控系统屏幕的变化,有一定的借鉴意义。
In the ticketing system of movie theaters,it is generally divided into two ways:online ticket sales and offline ticket sales.At present,there are mature software tools for online ticket sales,and users can automatically select various types of seat information online through mobile phones or computers.However,in offline ticket sales,the operator can only manually obtain different types of vacant seat information for a certain session by manually observing the screen interface of the ticketing system software,and then manually enter the vacant seat information into the ticketing system,print paper movie tickets,and then sell tickets.In view of the inconvenient and unfast situation that offline ticket sales require manual operation,the author uses C++language,based on OpenCV image processing library,to first quickly read the color image of the interface picture of the ticketing system software,and convert the three-channel color image into a single-channel grayscale image.The findContours()function is used to obtain the contour set of the image,and after removing the missing and too small contours,the contour position is obtained through the external rectangle,and the contour and the external rectangle are initialized as the corresponding instantiated objects of each seat.By reading the pixel information within the rectangle of each object,you can determine the color and position of the object.It realizes the automatic identification and positioning of various types of seat information on the screen,with an accuracy rate of 100%.Then,it is automatically entered into the ticketing system and automatically prints out the paper movie ticket,which achieves the purpose of automatic offline ticket sales.The technical methods used in the development of this system have certain reference significance for scenarios that need to identify the screen information of third-party software interfaces and their changes,such as monitoring the changes of the system screen.
作者
刘思樊
杨洋
童恒建
唐杰辰
LIU Si-fan;YANG Yang;TONG Heng-jian;TANG Jie-chen(School of Computer Science,China University of Geosciences,Wuhan 430000,China)
出处
《计算机技术与发展》
2024年第4期193-197,共5页
Computer Technology and Development
基金
国家自然科学基金资助项目(41171339,U1803117)。
关键词
OPENCV
轮廓提取
图像处理
二值化
数学形态学
OpenCV
contour extraction
image processing
binarization
mathematical morphology