《计算机技术与发展杂志》发表论文赏析
作者:刘思樊;杨洋;童恒建;唐杰辰
单位:中国地质大学(武汉) 计算机学院,湖北 武汉 430000 Author(s): LIU Si-fan;YANG Yang;TONG Heng-jian;TANG Jie-chen School of Computer Science,China University of Geosciences,Wuhan 430000,China 关键词: OpenCV;轮廓提取; 图像处理;二值化;数学形态学 Keywords: OpenCV;contour extraction;image processing;binarization;mathematical morphology 分类号: TP311. 1;TP399 DOI: 10. 3969 / j. issn. 1673-629X. 2024. 04. 029 摘要: 在电影院的票务系统中,一般分为线上售票和线下售票两种方式。 目前线上售票有成熟的软件工具,用户可以通过手机或电脑在线上自动选择各种类型的座位信息。 但在线下售票中,操作人员只能通过人工观察票务系统软件的屏幕界面,人工获取某个场次的不同类型的空余座位信息,然后再手工输入空余的座位信息到出票系统,打印纸质电影票后,然后进行售票。 针对线下售票需要人工操作这种不方便不快捷的情况,作者利用 C++语言,基于 OpenCV 图像处理库,首先快速读取票务系统软件的界面图片的彩色图像,将三通道的彩色图像转化为单通道的灰度图像。 利用 findContours( )函数获取图像的轮廓集,处理掉缺失和过小的轮廓后,通过外接矩形来获取轮廓的位置,将轮廓和外接矩形作为属性初始化对应的每个座位的实例化对象。 通过读取各个对象的矩形内的像素点信息,可以确定对象的颜色以及位置。 实现了对屏幕中各种不同类型的座位信息的自动识别与定位,准确率为 100% ;然后,自动输入到出票系统,自动打印出纸质电影票,达到了自动线下售票的目的。 开发此系统使用的技术方法,对于需要识别第三方软件界面的屏幕信息及其变化的场景,如:监控系统屏幕的变化,有一定的借鉴意义。 Abstract: In the ticketing system of movie theaters,it is generally divided into two ways:online ticket sales and offline ticket sales. Atpresent,there are mature software tools for online?ticket sales,and users can automatically select various types of seat information onlinethrough mobile phones or computers. However,in offline ticket sales,the operator can?only manually obtain different types of vacant seatinformation for a certain session by manually observing the screen interface of the ticketing system software,and then manually enter thevacant seat information into the ticketing system,print paper movie tickets,and then sell tickets. In view of the inconvenient and unfastsituation that offline ticket sales require manual operation,the author uses C++ language,based on OpenCV image processing library,tofirst quickly read the color image of the interface picture of the ticketing system software,and convert the three-channel color image intoa single-channel grayscale image. The findContours( ) function is used to obtain the contour set of the image,and after removing themissing and too small contours,the contour position is obtained through the external rectangle,and the contour and the external rectangleare 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 automaticallyprints out the paper movie ticket, which achieves the purpose of automatic offline ticket sales. The technical methods used in thedevelopment?of this system have certain reference significance for scenarios that need to identify the screen information of third - partysoftware interfaces and their changes,such as monitoring the changes of the system screen.
摘要:在电影院的票务系统中,一般分为线上售票和线下售票两种方式。 目前线上售票有成熟的软件工具,用户可以通过手机或电脑在线上自动选择各种类型的座位信息。 但在线下售票中,操作人员只能通过人工观察票务系统软件的屏幕界面,人工获取某个场次的不同类型的空余座位信息,然后再手工输入空余的座位信息到出票系统,打印纸质电影票后,然后进行售票。 针对线下售票需要人工操作这种不方便不快捷的情况,作者利用 C++语言,基于 OpenCV 图像处理库,首先快速读取票务系统软件的界面图片的彩色图像,将三通道的彩色图像转化为单通道的灰度图像。 利用 findContours( )函数获取图像的轮廓集,处理掉缺失和过小的轮廓后,通过外接矩形来获取轮廓的位置,将轮廓和外接矩形作为属性初始化对应的每个座位的实例化对象。 通过读取各个对象的矩形内的像素点信息,可以确定对象的颜色以及位置。 实现了对屏幕中各种不同类型的座位信息的自动识别与定位,准确率为 100% ;然后,自动输入到出票系统,自动打印出纸质电影票,达到了自动线下售票的目的。 开发此系统使用的技术方法,对于需要识别第三方软件界面的屏幕信息及其变化的场景,如:监控系统屏幕的变化,有一定的借鉴意义。
关键词:OpenCV;轮廓提取; 图像处理;二值化;数学形态学