[go: up one dir, main page]

CN117058255B - Color card identification method and device, electronic equipment and storage medium - Google Patents

Color card identification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117058255B
CN117058255B CN202311040900.4A CN202311040900A CN117058255B CN 117058255 B CN117058255 B CN 117058255B CN 202311040900 A CN202311040900 A CN 202311040900A CN 117058255 B CN117058255 B CN 117058255B
Authority
CN
China
Prior art keywords
color
blocks
color blocks
rectangular frame
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311040900.4A
Other languages
Chinese (zh)
Other versions
CN117058255A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mole Thread Intelligent Technology Beijing Co ltd
Original Assignee
Moore Threads Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Moore Threads Technology Co Ltd filed Critical Moore Threads Technology Co Ltd
Priority to CN202311040900.4A priority Critical patent/CN117058255B/en
Publication of CN117058255A publication Critical patent/CN117058255A/en
Application granted granted Critical
Publication of CN117058255B publication Critical patent/CN117058255B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The disclosure relates to a color card identification method and device, an electronic device and a storage medium, wherein the method comprises the following steps: performing color lump identification on the color lump image to obtain an identified initial color lump, wherein the initial color lump is at least part of color lump in the color lump image of the color lump; determining an average size of the initial color patch; determining a rectangular frame formed by the color blocks at the outermost periphery in the color card image according to the initial color blocks; determining a spacing between adjacent color blocks based on the rectangular box; and determining the positions of all color blocks in the color card image according to the average size and the distance between adjacent color blocks by taking the rectangular frame as a reference. According to the embodiment of the disclosure, all color blocks in the color card can be accurately identified, and the efficiency is high.

Description

一种色卡识别方法及装置、电子设备和存储介质Color card identification method and device, electronic device and storage medium

技术领域Technical Field

本公开涉及计算机技术领域,尤其涉及一种色卡识别方法及装置、电子设备和存储介质。The present disclosure relates to the field of computer technology, and in particular to a color card recognition method and device, an electronic device, and a storage medium.

背景技术Background technique

图像信号处理(ISP,Image Signal Processing)算法能够从图像传感器捕获的原始数据中提取高质量数字图像。通过对原始数据进行去噪、增强和优化,来得到清晰、准确的图像。ISP算法在各种与图像采集相关的应用场景中广泛使用,如智能手机、相机、安防监控、医疗图像处理和自动驾驶等。Image signal processing (ISP) algorithms can extract high-quality digital images from the raw data captured by image sensors. Clear and accurate images can be obtained by denoising, enhancing, and optimizing the raw data. ISP algorithms are widely used in various application scenarios related to image acquisition, such as smartphones, cameras, security monitoring, medical image processing, and autonomous driving.

颜色校正矩阵模块(Color Correction Matrix,CCM)是ISP处理流程中非常重要的一个模块。由于图像传感器对三原色的响应跟人眼有较大的差别,以及像素之间存在串扰(Crosstalk)现象,所以图像传感器输出的图像数据往往在经过CCM模块后才能还原出符合人眼感知的真实色彩。The Color Correction Matrix (CCM) is a very important module in the ISP processing flow. Since the image sensor's response to the three primary colors is quite different from that of the human eye, and there is crosstalk between pixels, the image data output by the image sensor can only be restored to the true color that conforms to human eye perception after passing through the CCM module.

在通过CCM模块进行颜色校正的过程中,需要通过色卡来计算CCM值,色卡是一种预先设定的包括多个色块的卡片,每个色块具有预设的颜色,各色块的颜色不同,通过多个色块(常用的为24个色块)来尽可能地覆盖一个宽泛的颜色范围,用于对色彩进行选择、比对、沟通,在一定范围内实现色彩标准的统一。In the process of color correction through the CCM module, it is necessary to calculate the CCM value through a color card. A color card is a pre-set card including multiple color blocks. Each color block has a preset color. The colors of the color blocks are different. Multiple color blocks (commonly used are 24 color blocks) are used to cover a wide color range as much as possible. It is used for color selection, comparison, and communication to achieve the unification of color standards within a certain range.

在该过程中,通常会用图像传感器拍摄色卡,然后需要准确地定位出图像中色块的位置,然后再进行后续的CCM值计算,然而,现有方式往往是通过人工标定的方式来定位色块的位置,效率较低。In this process, a color card is usually photographed with an image sensor, and then the position of the color block in the image needs to be accurately located before subsequent CCM value calculation. However, the existing method often locates the position of the color block through manual calibration, which is inefficient.

发明内容Summary of the invention

本公开提出了一种色卡识别技术方案。The present disclosure proposes a color card recognition technology solution.

根据本公开的一方面,提供了一种色卡识别方法,包括:According to one aspect of the present disclosure, a color card recognition method is provided, comprising:

对色卡图像进行色块识别,得到识别出的初始色块,所述初始色块为色卡图像的色块中的至少部分色块;Performing color block recognition on the color card image to obtain recognized initial color blocks, wherein the initial color blocks are at least part of the color blocks in the color card image;

确定所述初始色块的平均尺寸;Determining an average size of the initial color blocks;

根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;According to the initial color blocks, a rectangular frame formed by the outermost color blocks in the color card image is determined;

基于所述矩形框确定相邻色块之间的间距;Determine the spacing between adjacent color blocks based on the rectangular frame;

以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。Taking the rectangular frame as a reference, the positions of all color blocks in the color card image are determined according to the average size and the spacing between adjacent color blocks.

在一种可能的实现方式中,所述对色卡图像进行色块识别,得到识别出的初始色块,包括:In a possible implementation, the performing color block recognition on the color card image to obtain the recognized initial color block includes:

将所述色卡图像进行灰度化处理,并对灰度值进行二值化,得到二值化图像;Graying the color card image and binarizing the gray value to obtain a binary image;

对所述二值化图像进行黑白反转,得到反转图像;Reversing the binary image to obtain a reversed image;

在所述反转图像上进行白色轮廓检测,将检测到的白色轮廓的位置作为初始色块的位置。White contour detection is performed on the inverted image, and the position of the detected white contour is used as the position of the initial color block.

在一种可能的实现方式中,确定所述初始色块的平均尺寸,包括:In a possible implementation manner, determining the average size of the initial color block includes:

将检测到的初始色块的高度相加,并除以初始色块的数目,得到初始色块的平均高度;Add the heights of the detected initial color blocks and divide the sum by the number of initial color blocks to obtain the average height of the initial color blocks;

将检测到的初始色块的宽度相加,并除以初始色块的数目,得到初始色块的平均宽度。The widths of the detected initial color blocks are added together and divided by the number of initial color blocks to obtain the average width of the initial color blocks.

在一种可能的实现方式中,确定所述初始色块的平均尺寸,包括:In a possible implementation manner, determining the average size of the initial color block includes:

剔除初始色块中尺寸最大的色块,对剩余的初始色块的尺寸求平均值,得到初始色块的平均尺寸。The largest color block among the initial color blocks is removed, and the sizes of the remaining initial color blocks are averaged to obtain the average size of the initial color blocks.

在一种可能的实现方式中,根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框,包括:In a possible implementation, determining a rectangular frame formed by outermost color blocks in the color card image according to the initial color blocks includes:

确定各初始色块的中心点坐标;Determine the center point coordinates of each initial color block;

利用所有中心点坐标中水平方向的最小值和最大值,以及垂直方向的最小值和最大值,构建矩形框。Construct a rectangular box using the minimum and maximum values in the horizontal direction, as well as the minimum and maximum values in the vertical direction of all center point coordinates.

在一种可能的实现方式中,所述基于所述矩形框确定相邻色块之间的间距,包括:In a possible implementation manner, determining the spacing between adjacent color blocks based on the rectangular frame includes:

确定所述矩形框的在水平方向上的长度,并除以预设的水平方向的色块数目,得到相邻色块之间的水平间距;Determine the length of the rectangular frame in the horizontal direction, and divide it by the preset number of color blocks in the horizontal direction to obtain the horizontal spacing between adjacent color blocks;

确定所述矩形框的在垂直方向上的长度,并除以预设的垂直方向的色块数目,得到相邻色块之间的垂直间距。The length of the rectangular frame in the vertical direction is determined, and divided by the preset number of color blocks in the vertical direction to obtain the vertical spacing between adjacent color blocks.

在一种可能的实现方式中,以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置,包括:In a possible implementation, taking the rectangular frame as a reference and determining the positions of all color blocks in the color card image according to the average size and the spacing between adjacent color blocks, includes:

确定经过目标顶点的水平框线的斜率,以及竖直框线的斜率;Determine the slope of the horizontal frame line passing through the target vertex, and the slope of the vertical frame line;

将所述目标顶点作为一个色块的中心点位置,并以所述目标顶点为起始点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。The target vertex is taken as the center point of a color block, and the target vertex is taken as the starting point. According to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置,包括:In a possible implementation, taking the rectangular frame as a reference and determining the positions of all color blocks in the color card image according to the average size and the spacing between adjacent color blocks, includes:

确定所述矩形框的四条框线的中点;Determine the midpoints of the four frame lines of the rectangular frame;

连接两条竖直框线的中点,得到水平中线,并连接两条水平框线的中点,得到竖直中线;Connect the midpoints of the two vertical lines to get the horizontal center line, and connect the midpoints of the two horizontal lines to get the vertical center line;

确定所述水平中线的斜率,以及竖直中线的斜率;determining the slope of the horizontal centerline, and the slope of the vertical centerline;

按照所述色卡中色卡的排布规则,以所述水平中线和竖直中线的交点作为色块排布的中心点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。According to the arrangement rules of the color cards in the color card, the intersection of the horizontal center line and the vertical center line is used as the center point of the color block arrangement, and according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,所述根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框后,所述方法还包括:In a possible implementation, after determining the rectangular frame formed by the outermost color blocks in the color card image according to the initial color blocks, the method further includes:

确定所述矩形框的横纵比例;Determining the horizontal and vertical ratios of the rectangular frame;

所述确定相邻色块之间的间距,包括:The step of determining the spacing between adjacent color blocks includes:

在所述横纵比例符合预设比例范围的情况下,确定相邻色块之间的间距,所述预设比例范围为预先设置的矩形框的横纵比例的合理范围。When the horizontal and vertical ratios meet a preset ratio range, the spacing between adjacent color blocks is determined. The preset ratio range is a reasonable range of the horizontal and vertical ratios of the preset rectangular frame.

根据本公开的一方面,提供了一种色卡识别装置,包括:According to one aspect of the present disclosure, there is provided a color card recognition device, comprising:

初始识别模块,用于对色卡图像进行色块识别,得到识别出的初始色块,所述初始色块为色卡图像的色块中的至少部分色块;An initial recognition module, used to perform color block recognition on the color card image to obtain recognized initial color blocks, wherein the initial color blocks are at least part of the color blocks in the color card image;

平均尺寸确定模块,用于确定所述初始色块的平均尺寸;An average size determination module, used to determine the average size of the initial color blocks;

矩形框确定模块,用于根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;A rectangular frame determination module, used to determine a rectangular frame formed by the outermost color blocks in the color card image according to the initial color blocks;

间距确定模块,用于基于所述矩形框确定相邻色块之间的间距;A spacing determination module, used to determine the spacing between adjacent color blocks based on the rectangular frame;

位置确定模块,用于以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。The position determination module is used to determine the positions of all color blocks in the color card image based on the rectangular frame and the average size and the spacing between adjacent color blocks.

在一种可能的实现方式中,所述初始识别模块,用于将所述色卡图像进行灰度化处理,并对灰度值进行二值化,得到二值化图像;对所述二值化图像进行黑白反转,得到反转图像;在所述反转图像上进行白色轮廓检测,将检测到的白色轮廓的位置作为初始色块的位置。In a possible implementation, the initial recognition module is used to grayscale the color card image and binarize the grayscale values to obtain a binary image; reverse the binary image from black to white to obtain an inverted image; perform white contour detection on the inverted image, and use the position of the detected white contour as the position of the initial color block.

在一种可能的实现方式中,所述平均尺寸确定模块,用于:In a possible implementation, the average size determination module is used to:

将检测到的初始色块的高度相加,并除以初始色块的数目,得到初始色块的平均高度;Add the heights of the detected initial color blocks and divide the sum by the number of initial color blocks to obtain the average height of the initial color blocks;

将检测到的初始色块的宽度相加,并除以初始色块的数目,得到初始色块的平均宽度。The widths of the detected initial color blocks are added together and divided by the number of initial color blocks to obtain the average width of the initial color blocks.

在一种可能的实现方式中,所述平均尺寸确定模块,用于:In a possible implementation, the average size determination module is used to:

剔除初始色块中尺寸最大的色块,对剩余的初始色块的尺寸求平均值,得到初始色块的平均尺寸。The largest color block among the initial color blocks is removed, and the sizes of the remaining initial color blocks are averaged to obtain the average size of the initial color blocks.

在一种可能的实现方式中,所述矩形框确定模块,用于:In a possible implementation, the rectangular frame determination module is used to:

确定各初始色块的中心点坐标;Determine the center point coordinates of each initial color block;

利用所有中心点坐标中水平方向的最小值和最大值,以及垂直方向的最小值和最大值,构建矩形框。Construct a rectangular box using the minimum and maximum values in the horizontal direction, as well as the minimum and maximum values in the vertical direction of all center point coordinates.

在一种可能的实现方式中,所述间距确定模块,用于:In a possible implementation, the distance determination module is used to:

确定所述矩形框的在水平方向上的长度,并除以预设的水平方向的色块数目,得到相邻色块之间的水平间距;Determine the length of the rectangular frame in the horizontal direction, and divide it by the preset number of color blocks in the horizontal direction to obtain the horizontal spacing between adjacent color blocks;

确定所述矩形框的在垂直方向上的长度,并除以预设的垂直方向的色块数目,得到相邻色块之间的垂直间距。The length of the rectangular frame in the vertical direction is determined, and divided by the preset number of color blocks in the vertical direction to obtain the vertical spacing between adjacent color blocks.

在一种可能的实现方式中,所述位置确定模块,用于:In a possible implementation, the location determination module is used to:

确定经过目标顶点的水平框线的斜率,以及竖直框线的斜率;Determine the slope of the horizontal frame line passing through the target vertex, and the slope of the vertical frame line;

将所述目标顶点作为一个色块的中心点位置,并以所述目标顶点为起始点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。The target vertex is taken as the center point of a color block, and the target vertex is taken as the starting point. According to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,所述位置确定模块,用于:In a possible implementation, the location determination module is used to:

确定所述矩形框的四条框线的中点;Determine the midpoints of the four frame lines of the rectangular frame;

连接两条竖直框线的中点,得到水平中线,并连接两条水平框线的中点,得到竖直中线;Connect the midpoints of the two vertical lines to get the horizontal center line, and connect the midpoints of the two horizontal lines to get the vertical center line;

确定所述水平中线的斜率,以及竖直中线的斜率;determining the slope of the horizontal centerline, and the slope of the vertical centerline;

按照所述色卡中色卡的排布规则,以所述水平中线和竖直中线的交点作为色块排布的中心点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。According to the arrangement rules of the color cards in the color card, the intersection of the horizontal center line and the vertical center line is used as the center point of the color block arrangement, and according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:

比例确定模块,用于确定所述矩形框的横纵比例;A ratio determination module, used to determine the horizontal and vertical ratios of the rectangular frame;

所述间距确定模块,用于在所述横纵比例符合预设比例范围的情况下,确定相邻色块之间的间距,所述预设比例范围为预先设置的矩形框的横纵比例的合理范围。The spacing determination module is used to determine the spacing between adjacent color blocks when the horizontal and vertical ratios meet a preset ratio range, and the preset ratio range is a reasonable range of the horizontal and vertical ratios of the preset rectangular frame.

根据本公开的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.

根据本公开的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.

在本公开实施例中,通过对色卡图像进行色块识别,得到识别出的初始色块;然后确定所述初始色块的平均尺寸,并根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;然后基于所述矩形框确定相邻色块之间的间距;以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。由此,通过利用预先识别出的初始色块,能够准确地得到色块的平均尺寸和间距,然后确定出色块最外围的矩形框,能够准确地确定出所有色块所在的区域,再按照色块的平均尺寸和间距在矩形框中排列色块,最终得到所有色块的位置,准确地识别出其它未被初步识别出来的色块,且无需人工点击,效率较高。In the disclosed embodiment, the color block recognition is performed on the color card image to obtain the recognized initial color block; then the average size of the initial color block is determined, and based on the initial color block, the rectangular frame formed by the outermost color blocks in the color card image is determined; then the spacing between adjacent color blocks is determined based on the rectangular frame; based on the rectangular frame, the positions of all color blocks in the color card image are determined according to the average size and the spacing between adjacent color blocks. Thus, by using the pre-recognized initial color block, the average size and spacing of the color block can be accurately obtained, and then the outermost rectangular frame of the color block is determined, and the area where all color blocks are located can be accurately determined, and then the color blocks are arranged in the rectangular frame according to the average size and spacing of the color blocks, and finally the positions of all color blocks are obtained, and other color blocks that have not been preliminarily recognized are accurately identified, and no manual click is required, which is highly efficient.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。It should be understood that the above general description and the following detailed description are exemplary and explanatory only and do not limit the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

图1示出CCM校正前后图像传感器输出的色卡图像的示意图。FIG. 1 is a schematic diagram showing a color chart image output by an image sensor before and after CCM correction.

图2示出根据本公开实施例的色块识别方法的流程图。FIG. 2 shows a flow chart of a color block recognition method according to an embodiment of the present disclosure.

图3示出根据本公开实施例的初始色块的位置示意图。FIG. 3 is a schematic diagram showing the positions of initial color blocks according to an embodiment of the present disclosure.

图4示出根据本公开实施例的矩形框的位置示意图。FIG. 4 is a schematic diagram showing the position of a rectangular frame according to an embodiment of the present disclosure.

图5示出根据本公开实施例的灰度处理并反正后的色卡图像的示意图。FIG. 5 is a schematic diagram showing a color card image after grayscale processing and inversion according to an embodiment of the present disclosure.

图6示出根据本公开实施例得到的色卡位置的示意图。FIG. 6 is a schematic diagram showing the positions of color cards obtained according to an embodiment of the present disclosure.

图7示出根据本公开实施例的色块识别装置的框图。FIG. 7 shows a block diagram of a color block recognition device according to an embodiment of the present disclosure.

图8示出根据本公开实施例的一种电子设备的框图。FIG8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.

具体实施方式Detailed ways

以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

CCM图像校正的作用是校正图像传感器的光谱响应,通过校正后得到图像更符合人眼感知的真实色彩,图1示出CCM校正前后图像传感器输出的色卡图像的示意图。其中,图1中的(a)部分图像为CCM校正前输出的色卡图像,图1中的(b)部分图像为CCM校正后输出的色卡图像。The function of CCM image correction is to correct the spectral response of the image sensor. After correction, the image is more consistent with the real color perceived by the human eye. Figure 1 shows a schematic diagram of the color card image output by the image sensor before and after CCM correction. Part (a) of Figure 1 is the color card image output before CCM correction, and part (b) of Figure 1 is the color card image output after CCM correction.

CCM是一个3×3的矩阵,在计算某个图像传感器的CCM矩阵值时,通常将该图像传感器对着色卡进行拍摄,然后将色卡图像中各色块的R、G、B平均值去和X-Rite标准各色块的R、G、B目标值进行多项式拟合,从而得到最优化的CCM矩阵系数。CCM is a 3×3 matrix. When calculating the CCM matrix value of an image sensor, the image sensor is usually used to shoot a color card, and then the R, G, B average values of each color block in the color card image are polynomially fitted with the R, G, B target values of each color block in the X-Rite standard to obtain the optimized CCM matrix coefficients.

在CCM值的计算过程中,需要先准确定位出色卡图像中色块的位置才能计算出每个色块的R、G、B平均值。在相关技术中,可以通过手动用鼠标点击的方式指定各个色块的位置,但这种方法效率太低,还容易出错。此外,在一些利用图像识别算法识别色块的方法,往往也需要人工指定一些特殊色块,无法全自动识别色块,效率较低,且识别精度不高,容易出现识别不到的情况。In the process of calculating the CCM value, the position of the color block in the color card image must be accurately located before the R, G, and B average values of each color block can be calculated. In the related art, the position of each color block can be manually specified by clicking the mouse, but this method is too inefficient and prone to errors. In addition, in some methods of identifying color blocks using image recognition algorithms, some special color blocks often need to be manually specified, and color blocks cannot be fully automatically identified. The efficiency is low, and the recognition accuracy is not high, and it is easy to fail to recognize.

图2示出根据本公开实施例的色块识别方法的流程图,如图2所示,所述方法包括:FIG2 is a flow chart of a color block recognition method according to an embodiment of the present disclosure. As shown in FIG2 , the method includes:

在步骤S11中,对色卡图像进行色块识别,得到识别出的初始色块,所述初始色块为色卡图像的色块中的至少部分色块;In step S11, color block recognition is performed on the color card image to obtain recognized initial color blocks, where the initial color blocks are at least part of the color blocks in the color card image;

色卡图像是图像传感器对色卡进行拍摄到的图像,例如,图1中所示的两个图像,色卡图像中会包含色卡中的所有的色块,为了便于后续的色块识别,在通过图像传感器拍摄色卡时,可以使图像传感器正对色卡进行拍摄,以使得多个色块在色卡图像中的尺寸差异较小,便于后续基于色块在图像中的尺寸进行色块识别。The color card image is an image of the color card captured by the image sensor. For example, the two images shown in Figure 1 include all the color blocks in the color card. To facilitate subsequent color block recognition, when the color card is captured by the image sensor, the image sensor can be directed toward the color card to minimize the size differences of the multiple color blocks in the color card image, thereby facilitating subsequent color block recognition based on the size of the color blocks in the image.

在该步骤中,对色块的识别仅为初步的识别,具体识别的方式可以有多种,在一个示例中,可以根据色块的像素值与背景像素值的差异,通过阈值分割的方式,对色块进行识别;在另一个示例中,还可以根据色块的边缘的灰度值的变化,通过基于边缘检测的分割方式,对色块进行识别;在另一个示例中,还可以基于深度学习算法,通过对图像特征进行编码,利用神经网络来对色块进行识别,该神经网络例如可以是卷积神经网络、残差神经网络等等。In this step, the recognition of color blocks is only preliminary, and there can be many specific recognition methods. In one example, the color blocks can be identified by threshold segmentation based on the difference between the pixel value of the color block and the background pixel value; in another example, the color blocks can be identified by edge detection-based segmentation based on the change of the grayscale value of the edge of the color block; in another example, the color blocks can be identified by encoding image features based on a deep learning algorithm and using a neural network, which can be, for example, a convolutional neural network, a residual neural network, and the like.

需要说明的是,色卡中的色块的颜色往往有多种,以便覆盖较宽的颜色范围,使得图像传感器普适于多种颜色,由于色块的颜色较多,因此,单纯基于颜色的图像识别,可能无法将所有色块都识别出来,即识别出的初始色块可能是色卡图像的色块中的部分色块。例如,在标准的24色卡中,图像右下角的色块为黑色,且色块的背景颜色往往也是黑色,导致该色块无法被识别出。It should be noted that the color blocks in the color card often have multiple colors in order to cover a wider color range, so that the image sensor is universally applicable to multiple colors. Since the color blocks have many colors, image recognition based solely on color may not be able to recognize all the color blocks, that is, the initial color blocks recognized may be part of the color blocks in the color card image. For example, in a standard 24-color card, the color block in the lower right corner of the image is black, and the background color of the color block is often also black, resulting in the color block being unable to be recognized.

图3示出根据本公开实施例的初始色块的位置示意图,如图3所示,识别出的初始色块仅为所有色块中的部分色块(由白框所包围的色块),尤其对于右下角纯黑色的色块而言,其与背景颜色完全相同,导致基于颜色的色块识别算法很难将其识别出来。Figure 3 shows a schematic diagram of the position of the initial color blocks according to an embodiment of the present disclosure. As shown in Figure 3, the identified initial color blocks are only some of the color blocks (the color blocks surrounded by white frames) among all the color blocks. In particular, for the pure black color block in the lower right corner, its color is exactly the same as the background color, which makes it difficult for the color-based color block recognition algorithm to recognize it.

在步骤S12中,确定所述初始色块的平均尺寸;In step S12, determining the average size of the initial color blocks;

初始色块在被识别出来后,即可得到其在色卡图像中的位置和尺寸,这里的位置可以是色卡中心点的位置,尺寸可以是色卡的长和宽。这里的平均尺寸可以是初始色块在色卡图像中的尺寸,具体可以通过对初始色块取平均值得到。After the initial color block is identified, its position and size in the color card image can be obtained. The position here can be the position of the center point of the color card, and the size can be the length and width of the color card. The average size here can be the size of the initial color block in the color card image, which can be obtained by taking the average value of the initial color block.

在一种可能的实现方式中,确定所述初始色块的平均尺寸,包括:将检测到的初始色块的高度相加,并除以初始色块的数目,得到初始色块的平均高度;将检测到的初始色块的宽度相加,并除以初始色块的数目,得到初始色块的平均宽度。由此,通过确定初始色块的平均尺寸,以便利用该平均尺寸,准确地识别出其它未被初步识别出来的色块。In a possible implementation, determining the average size of the initial color blocks includes: adding the heights of the detected initial color blocks and dividing the sum by the number of the initial color blocks to obtain the average height of the initial color blocks; adding the widths of the detected initial color blocks and dividing the sum by the number of the initial color blocks to obtain the average width of the initial color blocks. Thus, by determining the average size of the initial color blocks, other color blocks that have not been initially identified can be accurately identified using the average size.

作为该步骤的另一种可能的实现方式,确定所述初始色块的平均尺寸,包括:剔除初始色块中尺寸最大的色块,对剩余的初始色块的尺寸求平均值,得到初始色块的平均尺寸。在该实现方式中,考虑到由于各种原因,采集到的色卡图像中会存在畸变,导致图像边缘的色块被拉长,即色块尺寸明显变大,而图像中的其它色块的尺寸则差距较小,由此,通过剔除初始色块中尺寸最大的色块,能够将图像边缘由于镜头畸变导致的尺寸不一致的色块排除掉,避免影响无图像畸变区域的大部分色块的识别。并且,由于图像边缘的初始色块尺寸较大,因此,利用较小的平均尺寸,仍然能够准确地识别出图像边缘的初始色块中的局部区域,由于CCM图像校正中无需使用单个色块中的全部区域,因此,仅利用识别出的局部区域进行CCM图像校正并不影响图像校正的准确性。显然,通过剔除初始色块中尺寸最大的色块,减少了对初始色块平均尺寸的影响,提高了后续基于初始色块平均尺寸进行色块定位的准确度。As another possible implementation of this step, determining the average size of the initial color block includes: removing the largest color block in the initial color block, averaging the sizes of the remaining initial color blocks, and obtaining the average size of the initial color block. In this implementation, considering that due to various reasons, there may be distortion in the collected color card image, resulting in the color block at the edge of the image being elongated, that is, the size of the color block is significantly enlarged, while the size of other color blocks in the image is relatively small, thus, by removing the largest color block in the initial color block, the color blocks with inconsistent sizes at the edge of the image due to lens distortion can be excluded, avoiding affecting the recognition of most color blocks in the area without image distortion. In addition, since the size of the initial color block at the edge of the image is large, the local area in the initial color block at the edge of the image can still be accurately identified by using a smaller average size. Since the entire area of a single color block does not need to be used in CCM image correction, only using the identified local area for CCM image correction does not affect the accuracy of image correction. Obviously, by removing the largest color block in the initial color blocks, the influence on the average size of the initial color blocks is reduced, and the accuracy of subsequent color block positioning based on the average size of the initial color blocks is improved.

在步骤S13中,根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;In step S13, based on the initial color blocks, a rectangular frame formed by the outermost color blocks in the color card image is determined;

由于初步的色块识别可能只识别出了部分的色块,如图3所示,在这些初始色块中,最外围的四条边线均至少有一个色块被识别出,且通过大量实验验证,在绝大多数情况下,通过初步的色块识别,最外围的四条边线均至少有一个色块被识别出。因此,可以利用初始色块的坐标值,来确定色卡图像中最外围的色块构成的矩形框。Since the initial color block recognition may only recognize part of the color blocks, as shown in FIG3, among these initial color blocks, at least one color block is recognized on each of the four outermost edges, and through a large number of experiments, in most cases, at least one color block is recognized on each of the four outermost edges through initial color block recognition. Therefore, the coordinate values of the initial color blocks can be used to determine the rectangular frame formed by the outermost color blocks in the color card image.

这里的矩形框可以是色卡图像中最外围的色块的中心点的连线构成的矩形框,或者,也可以是色块同一侧的顶点的连线构成的矩形框。因此,可以通过确定初始色块的中心点来确定矩形框,或者通过确定初始色块的顶点来确定矩形框。具体可参见本公开提供的可能的实现方式,此处不做赘述。The rectangular frame here can be a rectangular frame formed by connecting the center points of the outermost color blocks in the color card image, or it can also be a rectangular frame formed by connecting the vertices on the same side of the color block. Therefore, the rectangular frame can be determined by determining the center point of the initial color block, or by determining the vertices of the initial color block. For details, please refer to the possible implementation methods provided in the present disclosure, which will not be repeated here.

图4示出根据本公开实施例的矩形框的位置示意图。该矩形框为色卡图像中最外围的色块的中心点的连线构成的矩形框。Fig. 4 is a schematic diagram showing the position of a rectangular frame according to an embodiment of the present disclosure. The rectangular frame is a rectangular frame formed by connecting the center points of the outermost color blocks in the color card image.

在步骤S14中,基于所述矩形框确定相邻色块之间的间距;In step S14, the spacing between adjacent color blocks is determined based on the rectangular frame;

相邻色块之间的间距可以是相邻色块的中心点之间的距离,或者也可以是相邻色块的同侧顶点之间的距离,例如,相邻色块左下角顶点的距离。The spacing between adjacent color blocks may be the distance between the center points of adjacent color blocks, or may also be the distance between the vertices on the same side of adjacent color blocks, for example, the distance between the lower left corner vertices of adjacent color blocks.

在一种可能的实现方式中,基于所述矩形框确定相邻色块之间的间距,包括:确定所述矩形框的在水平方向上的长度,并除以预设的水平方向的色块数目,得到相邻色块之间的水平间距;确定所述矩形框的在垂直方向上的长度,并除以预设的垂直方向的色块数目,得到相邻色块之间的垂直间距。In a possible implementation, determining the spacing between adjacent color blocks based on the rectangular frame includes: determining the length of the rectangular frame in the horizontal direction, and dividing it by a preset number of color blocks in the horizontal direction to obtain the horizontal spacing between adjacent color blocks; determining the length of the rectangular frame in the vertical direction, and dividing it by a preset number of color blocks in the vertical direction to obtain the vertical spacing between adjacent color blocks.

在确定出矩形框后,即可确定出矩形框在水平方向和垂直方向上的长度,具体可以通过矩形框顶点的坐标来确定,此处不做赘述。而色卡中色块的排布规则是已知的,示例性的,如图3所示,在24色卡中,水平方向上有6个色块,垂直方向上有4个色块。那么,相邻色块之间的间距,即可以通过矩形框在某个方向上的长度除以该方向上色块的数量来确定。After determining the rectangular frame, the length of the rectangular frame in the horizontal and vertical directions can be determined. Specifically, it can be determined by the coordinates of the vertices of the rectangular frame, which will not be described here. The arrangement rules of the color blocks in the color card are known. For example, as shown in Figure 3, in the 24-color card, there are 6 color blocks in the horizontal direction and 4 color blocks in the vertical direction. Then, the spacing between adjacent color blocks can be determined by dividing the length of the rectangular frame in a certain direction by the number of color blocks in that direction.

示例性的,针对24色块而言,可以确定矩形框在水平方向上的长度,然后除以水平方向上的色块数目6,即可得到相邻色块之间的水平间距;然后确定矩形框的在垂直方向上的长度,然后除以垂直方向的色块数目4,得到相邻色块之间的垂直间距。其中,水平方向和垂直方向上的色块数目均为预先设定的。For example, for 24 color blocks, the length of the rectangular frame in the horizontal direction can be determined, and then divided by the number of color blocks in the horizontal direction, 6, to obtain the horizontal spacing between adjacent color blocks; then the length of the rectangular frame in the vertical direction can be determined, and then divided by the number of color blocks in the vertical direction, 4, to obtain the vertical spacing between adjacent color blocks. The number of color blocks in the horizontal direction and the number of color blocks in the vertical direction are both preset.

在本公开实施例中,通过确定所述矩形框的在水平方向上的长度,并除以预设的水平方向的色块数目,得到相邻色块之间的水平间距;确定所述矩形框的在垂直方向上的长度,并除以预设的垂直方向的色块数目,得到相邻色块之间的垂直间距。由此,能够利用初步识别出的部分色块(初始色块),基于预先设定的水平方向和垂直方向上的色块数目,准确地确定出色卡图像中相邻色块之间的间距。In the disclosed embodiment, the horizontal distance between adjacent color blocks is obtained by determining the length of the rectangular frame in the horizontal direction and dividing it by the preset number of color blocks in the horizontal direction; the vertical distance between adjacent color blocks is obtained by determining the length of the rectangular frame in the vertical direction and dividing it by the preset number of color blocks in the vertical direction. Thus, the distance between adjacent color blocks in the color card image can be accurately determined based on the preset number of color blocks in the horizontal and vertical directions by using the initially identified partial color blocks (initial color blocks).

在步骤S15中,以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。In step S15, the positions of all color blocks in the color card image are determined based on the rectangular frame and the average size and the distance between adjacent color blocks.

由于矩形框确定了所有色块在色卡中所在的区域,且色块在色卡中是按照等间距规则排列的,因此,在确定出了色块之间的间距和平均尺寸之后,可以以矩形框为基准,按照相邻色块之间的间距,在矩形框中等间距地排列平均尺寸的色块,即可得到色卡图像中所有色卡的位置。Since the rectangular frame determines the area where all color blocks are located in the color card, and the color blocks are arranged in the color card according to the equal spacing rule, after determining the spacing and average size between the color blocks, the rectangular frame can be used as a reference. According to the spacing between adjacent color blocks, the color blocks of average size can be arranged in the rectangular frame at equal spacing to obtain the positions of all color cards in the color card image.

在本公开实施例中,通过对色卡图像进行色块识别,得到识别出的初始色块;然后确定所述初始色块的平均尺寸,并根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;然后基于所述矩形框确定相邻色块之间的间距;以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。由此,通过利用预先识别出的初始色块,能够准确地得到色块的平均尺寸和间距,然后确定出色块最外围的矩形框,能够准确地确定出所有色块所在的区域,再按照色块的平均尺寸和间距在矩形框中排列色块,最终得到所有色块的位置,准确地识别出其它未被初步识别出来的色块,且无需人工点击,效率较高。In the disclosed embodiment, the color block recognition is performed on the color card image to obtain the recognized initial color block; then the average size of the initial color block is determined, and based on the initial color block, the rectangular frame formed by the outermost color blocks in the color card image is determined; then the spacing between adjacent color blocks is determined based on the rectangular frame; based on the rectangular frame, the positions of all color blocks in the color card image are determined according to the average size and the spacing between adjacent color blocks. Thus, by using the pre-recognized initial color block, the average size and spacing of the color block can be accurately obtained, and then the outermost rectangular frame of the color block is determined, and the area where all color blocks are located can be accurately determined, and then the color blocks are arranged in the rectangular frame according to the average size and spacing of the color blocks, and finally the positions of all color blocks are obtained, and other color blocks that have not been preliminarily recognized are accurately identified, and no manual click is required, which is highly efficient.

在一种可能的实现方式中,所述对色卡图像进行色块识别,得到识别出的初始色块,包括:将所述色卡图像进行灰度化处理,并对灰度值进行二值化,得到二值化图像;对所述二值化图像进行黑白反转,得到反转图像;在所述反转图像上进行白色轮廓检测,将检测到的白色轮廓的位置作为初始色块的位置。In a possible implementation, the color block recognition of the color card image to obtain the recognized initial color block includes: graying the color card image and binarizing the grayscale value to obtain a binary image; inverting the binary image in black and white to obtain an inverted image; and detecting a white contour on the inverted image, and using the position of the detected white contour as the position of the initial color block.

图5示出根据本公开实施例的灰度处理并反正后的色卡图像的示意图。将所述色卡图像进行灰度化处理,以去除RGB颜色信息,得到色卡图像中各像素点的灰度值,然后对灰度值进行二值化,在一个示例中,二值化可以是将灰度值大于某个阈值的像素点的值置为1,将灰度值小于某个阈值的像素点的值置为0,即可得到二值化图像,二值化图像能够简化后续的图像处理流程,降低图像处理过程中消耗的处理资源。Fig. 5 shows a schematic diagram of a color card image after grayscale processing according to an embodiment of the present disclosure. The color card image is grayscaled to remove RGB color information, and the grayscale value of each pixel in the color card image is obtained, and then the grayscale value is binarized. In an example, the binarization can be to set the value of the pixel whose grayscale value is greater than a certain threshold to 1, and to set the value of the pixel whose grayscale value is less than a certain threshold to 0, so as to obtain a binary image. The binary image can simplify the subsequent image processing process and reduce the processing resources consumed in the image processing process.

然后对所述二值化图像进行黑白反转,得到反转图像,该反转的过程即为将0置为1,将1置为0,得到反转图像,这样,得到的反转图像上,色块的边缘区域呈白色,那么,在反转图像上进行白色轮廓检测,即可检测到初始色块的位置。Then, the binary image is inverted from black to white to obtain an inverted image. The inversion process is to set 0 to 1 and 1 to 0 to obtain an inverted image. In this way, the edge area of the color block on the obtained inverted image is white. Then, by performing white contour detection on the inverted image, the position of the initial color block can be detected.

在本公开实施例中,通过将所述色卡图像进行灰度化处理,并对灰度值进行二值化,得到二值化图像;对所述二值化图像进行黑白反转,得到反转图像;在所述反转图像上进行白色轮廓检测,将检测到的白色轮廓的位置作为初始色块的位置。由于经过灰度化、二值化以及黑白反转操作后,反转图像上的白色像素点的数量较少,因此,在反转图像上进行白色轮廓的检测,能够减少运算量,提高色卡识别的效率。In the disclosed embodiment, the color card image is grayed and the gray value is binarized to obtain a binarized image; the binarized image is black-white inverted to obtain an inverted image; white contour detection is performed on the inverted image, and the position of the detected white contour is used as the position of the initial color block. Since the number of white pixels on the inverted image is small after the graying, binarization and black-white inversion operations, the white contour detection on the inverted image can reduce the amount of calculation and improve the efficiency of color card recognition.

在一种可能的实现方式中,根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框,包括:确定各初始色块的中心点坐标;利用所有中心点坐标中水平方向的最小值和最大值,以及垂直方向的最小值和最大值,构建矩形框。In a possible implementation, a rectangular frame formed by the outermost color blocks in the color card image is determined based on the initial color blocks, including: determining the center point coordinates of each initial color block; and constructing a rectangular frame using the minimum and maximum values in the horizontal direction and the minimum and maximum values in the vertical direction of all center point coordinates.

初始色块的中心点坐标可以基于检测到的初始色块的位置来确定,接上例,初始色块的初始位置可以是白色轮廓线的位置,具体可以是多个白色像素点的坐标值,基于这些坐标值,取水平和垂直方向上的平均值,即可得到初始色块的中心点。The coordinates of the center point of the initial color block can be determined based on the detected position of the initial color block. Continuing with the above example, the initial position of the initial color block can be the position of the white contour line, specifically the coordinate values of multiple white pixels. Based on these coordinate values, the average values in the horizontal and vertical directions are taken to obtain the center point of the initial color block.

在确定各初始色块的中心点坐标后,所有中心点坐标中水平方向的最小值,即可作为矩形框左侧两个顶点的x值;所有中心点坐标中水平方向的最大值,即可作为矩形框右侧两个顶点的x值;所有中心点坐标中垂直方向的最小值,即可作为矩形框下部两个顶点的y值;所有中心点坐标中垂直方向的最大值,即可作为矩形框上部两个顶点的y值。在确定了4个顶点的x值和y值后,将矩形框的4个顶点连接,即可得到矩形框。After determining the center point coordinates of each initial color block, the minimum value in the horizontal direction of all center point coordinates can be used as the x value of the two vertices on the left side of the rectangular frame; the maximum value in the horizontal direction of all center point coordinates can be used as the x value of the two vertices on the right side of the rectangular frame; the minimum value in the vertical direction of all center point coordinates can be used as the y value of the two vertices at the bottom of the rectangular frame; the maximum value in the vertical direction of all center point coordinates can be used as the y value of the two vertices at the top of the rectangular frame. After determining the x and y values of the four vertices, connect the four vertices of the rectangular frame to get the rectangular frame.

在本公开实施例中,通过确定各初始色块的中心点坐标,利用所有中心点坐标中水平方向的最小值和最大值,以及垂直方向的最小值和最大值,构建矩形框。由此,能够准确地确定出色卡图像中所有色块所在的范围,便于后续在该范围中排布色块以便准确地确定色块的位置。In the embodiment of the present disclosure, by determining the center point coordinates of each initial color block, and using the minimum and maximum values in the horizontal direction and the minimum and maximum values in the vertical direction of all the center point coordinates, a rectangular frame is constructed. Thus, the range where all the color blocks in the color card image are located can be accurately determined, which facilitates the subsequent arrangement of the color blocks in the range to accurately determine the positions of the color blocks.

在一种可能的实现方式中,以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置,包括:确定经过目标顶点的水平框线的斜率,以及竖直框线的斜率;将所述目标顶点作为一个色块的中心点位置,并以所述目标顶点为起始点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。In a possible implementation, the positions of all color blocks in the color card image are determined based on the rectangular frame as a reference and the average size and the spacing between adjacent color blocks, including: determining the slope of the horizontal frame line passing through the target vertex and the slope of the vertical frame line; taking the target vertex as the center point position of a color block, and taking the target vertex as the starting point, arranging multiple color blocks in sequence in the rectangular frame according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, to obtain the positions of all color blocks in the color card image.

水平框线的斜率可以是任意一条水平框线的斜率,或者也可以是两条水平框线的斜率的平均值。以水平框线为矩形框下部的水平框线为例,其斜率k1可具体表示为:The slope of the horizontal frame line can be the slope of any horizontal frame line, or can also be the average of the slopes of two horizontal frame lines. Taking the horizontal frame line as the horizontal frame line at the bottom of the rectangular frame as an example, its slope k1 can be specifically expressed as:

k1=( y1–y2)/( x1–x2) (1)k 1 =( y 1 –y 2 )/( x 1 –x 2 ) (1)

其中,y1表示左下角顶点的y值,y2表示右下角顶点的y值,x1表示左下角顶点的x值,x2表示右下角顶点的x值。Among them, y1 represents the y value of the lower left vertex, y2 represents the y value of the lower right vertex, x1 represents the x value of the lower left vertex, and x2 represents the x value of the lower right vertex.

竖直框线的斜率可以是任意一条竖直框线的斜率,或者也可以是两条竖直框线的斜率的平均值。以竖直框线为矩形框右侧的竖直框线为例,其斜率k2可具体表示为:The slope of the vertical frame line can be the slope of any vertical frame line, or can also be the average of the slopes of two vertical frame lines. Taking the vertical frame line on the right side of the rectangular frame as an example, its slope k2 can be specifically expressed as:

k2=( y3–y4)/( x3–x4) (2)k 2 =( y 3 –y 4 )/( x 3 –x 4 ) (2)

其中,y3表示右上角顶点的y值,y4表示右下角顶点的y值,x3表示右上角顶点的x值,x4表示右下角顶点的x值。Among them, y 3 represents the y value of the upper right vertex, y 4 represents the y value of the lower right vertex, x 3 represents the x value of the upper right vertex, and x 4 represents the x value of the lower right vertex.

目标顶点可以是矩形框的任意一个顶点,以目标顶点为右下角顶点为例,可以在目标顶点的右下角顶点作为最右下角的色块的中心点位置,然后按照相邻色块之间的间距,沿水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。The target vertex can be any vertex of the rectangular box. Taking the target vertex as the lower right corner vertex as an example, the lower right corner vertex of the target vertex can be used as the center point of the lower right color block, and then according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular box to obtain the positions of all color blocks in the color card image.

以图4所示的24色卡为例,上述确定色卡图像中所有色块的位置的具体数学过程可以实现为:以右下角为原点建立直角坐标系,从右向左为横轴正方向,从下向上为纵轴正方向;用相邻色块之间的水平间距乘以水平框线的斜率,即可得到与右下角色块相邻的水平方向上的第一个色块的中心点的纵坐标值,其横坐标值为相邻色块之间的水平间距;用两倍的相邻色块之间的水平间距乘以水平框线的斜率,即可得到与右下角相邻的水平方向上的第二个色块的中心点的纵坐标值,其横坐标值为两倍的相邻色块之间的水平间距,以此类推,即可得到最下排水平方向上的六个色块的中心点的坐标。Taking the 24-color card shown in Figure 4 as an example, the specific mathematical process of determining the positions of all color blocks in the color card image can be implemented as follows: a rectangular coordinate system is established with the lower right corner as the origin, with the positive direction of the horizontal axis from right to left and the positive direction of the vertical axis from bottom to top; the horizontal spacing between adjacent color blocks is multiplied by the slope of the horizontal frame line to obtain the ordinate value of the center point of the first color block in the horizontal direction adjacent to the lower right color block, and its horizontal coordinate value is the horizontal spacing between adjacent color blocks; twice the horizontal spacing between adjacent color blocks is multiplied by the slope of the horizontal frame line to obtain the ordinate value of the center point of the second color block in the horizontal direction adjacent to the lower right corner, and its horizontal coordinate value is twice the horizontal spacing between adjacent color blocks, and so on, the coordinates of the center points of the six color blocks in the horizontal direction of the bottom row can be obtained.

用相邻色块之间的垂直间距乘以竖直框线的斜率,即可得到与右下角色块相邻的垂直方向上的第一个色块的中心点的横坐标值,其纵坐标值为相邻色块之间的垂直间距;用两倍的相邻色块之间的垂直间距乘以竖直框线的斜率,即可得到与右下角相邻的垂直方向上的第二个色块的中心点的横坐标值,其纵坐标值为相邻色块之间的垂直间距的两倍;以此类推,即可得到最右侧垂直方向上的四个色块的中心点的坐标。然后,分别以最右侧的三个色块的中心点为原点,分别乘以相邻色块之间的间距,依次得到剩余的15个色块的中心点的坐标,具体过程不做赘述。By multiplying the vertical spacing between adjacent color blocks by the slope of the vertical frame line, we can get the horizontal coordinate value of the center point of the first color block in the vertical direction adjacent to the lower right character block, and its vertical coordinate value is the vertical spacing between adjacent color blocks; by multiplying twice the vertical spacing between adjacent color blocks by the slope of the vertical frame line, we can get the horizontal coordinate value of the center point of the second color block in the vertical direction adjacent to the lower right corner, and its vertical coordinate value is twice the vertical spacing between adjacent color blocks; and so on, we can get the coordinates of the center points of the four color blocks in the rightmost vertical direction. Then, take the center points of the three rightmost color blocks as the origin, multiply them by the spacing between adjacent color blocks, and get the coordinates of the center points of the remaining 15 color blocks in turn. The specific process will not be repeated.

在确定了各色块的中心点坐标后,由于色块的平均尺寸是已知的,因此,以各中心点确定各色块的最外围边缘的像素点的坐标,即可得到个色块的位置。图6示出根据本公开实施例得到的色卡位置的示意图,其中,黑框所框出的24个位置即为识别出的24个色卡的位置,利用黑框中的颜色,进行颜色校正即可。虽然黑框中的位置并非整个色块的最外围的边框,但识别出的色块部分足以进行后续的颜色校正。After determining the coordinates of the center points of each color block, since the average size of the color block is known, the coordinates of the pixel points at the outermost edge of each color block are determined by each center point, and the position of each color block can be obtained. FIG6 shows a schematic diagram of the color card positions obtained according to an embodiment of the present disclosure, wherein the 24 positions framed by the black frame are the positions of the 24 identified color cards, and color correction can be performed using the colors in the black frame. Although the position in the black frame is not the outermost border of the entire color block, the identified color block portion is sufficient for subsequent color correction.

在一种可能的实现方式中,以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置,包括:确定所述矩形框的四条框线的中点;连接两条竖直框线的中点,得到水平中线,并连接两条水平框线的中点,得到竖直中线;确定所述水平中线的斜率,以及竖直中线的斜率;按照所述色卡中色卡的排布规则,以所述水平中线和竖直中线的交点作为色块排布的中心点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。In a possible implementation, the rectangular frame is used as a reference, and the positions of all color blocks in the color card image are determined according to the average size and the spacing between adjacent color blocks, including: determining the midpoints of the four frame lines of the rectangular frame; connecting the midpoints of two vertical frame lines to obtain a horizontal center line, and connecting the midpoints of two horizontal frame lines to obtain a vertical center line; determining the slope of the horizontal center line and the slope of the vertical center line; according to the arrangement rules of the color cards in the color card, taking the intersection of the horizontal center line and the vertical center line as the center point of the color block arrangement, arranging multiple color blocks in sequence in the rectangular frame according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, to obtain the positions of all color blocks in the color card image.

矩形框的四条框线的中点,可以依据矩形框的顶点来确定,然后连接两条竖直框线的中点(即左右两个中点)得到水平中线,连接两条水平框线的中点(即上下两个中点)得到竖直中线。The midpoints of the four frame lines of the rectangular frame can be determined based on the vertices of the rectangular frame, and then the midpoints of the two vertical frame lines (i.e., the left and right midpoints) are connected to obtain the horizontal midline, and the midpoints of the two horizontal frame lines (i.e., the upper and lower midpoints) are connected to obtain the vertical midline.

竖直中线和水平中线的交点即为矩形框的中点,以该中点为原点建立直角坐标系,从左向右为横轴正方向,从下向上为纵轴正方向;用相邻色块之间的水平间距的一半乘以水平中线的斜率,即可得到原点右上方的第一个色块的中心点的纵坐标值,其横坐标值为相邻色块之间的水平间距的一半,该具体过程与前述实现方式类似,对于其它色块的位置确定过程,此处不做赘述。The intersection of the vertical center line and the horizontal center line is the midpoint of the rectangular frame. A rectangular coordinate system is established with the midpoint as the origin, with the positive direction of the horizontal axis from left to right and the positive direction of the vertical axis from bottom to top. Multiplying half of the horizontal spacing between adjacent color blocks by the slope of the horizontal center line can give the vertical coordinate value of the center point of the first color block to the upper right of the origin, and its horizontal coordinate value is half of the horizontal spacing between adjacent color blocks. The specific process is similar to the aforementioned implementation method, and the process of determining the positions of other color blocks will not be repeated here.

在该实现方式中,通过确定矩形框的中心点,以中心点为起点确定各个色块的位置,减少了以边缘为起点可能会由于图像畸变导致定位不准确的情况,提高了确定的色块位置的准确性。In this implementation, the center point of the rectangular frame is determined, and the position of each color block is determined using the center point as the starting point, thereby reducing the possibility of inaccurate positioning due to image distortion when using the edge as the starting point, and improving the accuracy of the determined color block position.

在一种可能的实现方式中,所述根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框后,所述方法还包括:确定所述矩形框的横纵比例;所述确定相邻色块之间的间距,包括:在所述横纵比例符合预设比例范围的情况下,确定相邻色块之间的间距,所述预设比例范围为预先设置的矩形框的横纵比例的合理范围。In a possible implementation, after determining the rectangular frame formed by the outermost color blocks in the color card image based on the initial color blocks, the method further includes: determining the horizontal and vertical ratios of the rectangular frame; determining the spacing between adjacent color blocks includes: determining the spacing between adjacent color blocks when the horizontal and vertical ratios are within a preset ratio range, and the preset ratio range is a reasonable range of the horizontal and vertical ratios of the preset rectangular frame.

矩形框的横纵比例,可以是任意一条水平框线与任意一条竖直框线的比例,或者,也可以是竖直中线与水平中线的比例。The horizontal and vertical ratio of the rectangular frame may be the ratio of any horizontal frame line to any vertical frame line, or may be the ratio of the vertical center line to the horizontal center line.

在某些极端情况下,色卡最外围某一列或某一行色块没有在初步识别时识别到任一初始色块,为了提高构建的矩形框的准确性,可以预先设置矩形框的横纵比例的合理范围,超出该合理范围,则认为可能是色卡最外围某一列或某一行色块没有在初步识别时识别到任一初始色块。具体的预设比例范围可以根据实际应用确定,本公开对此不作限定。In some extreme cases, a color block in a column or a row at the outermost edge of the color card does not recognize any initial color block during the initial recognition. In order to improve the accuracy of the constructed rectangular frame, a reasonable range of the horizontal and vertical ratios of the rectangular frame can be preset. If the reasonable range is exceeded, it is considered that a color block in a column or a row at the outermost edge of the color card may not recognize any initial color block during the initial recognition. The specific preset ratio range can be determined according to actual applications, and the present disclosure does not limit this.

因此,通过在所述横纵比例符合预设比例范围的情况下,确定相邻色块之间的间距,可以提高最终得到的色卡图像中所有色块位置的准确性。Therefore, by determining the spacing between adjacent color blocks when the horizontal and vertical ratios meet the preset ratio range, the accuracy of the positions of all color blocks in the final color card image can be improved.

在一种可能的实现方式中,所述色块识别方法可通过终端设备和服务器等电子设备执行,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等,所述方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。In one possible implementation, the color block recognition method can be executed by electronic devices such as terminal devices and servers. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor calling computer-readable instructions stored in a memory.

此外,本公开还提供了一种色块识别装置、电子设备、计算机可读存储介质、程序,上述均可用来实现本公开提供的任一种色块识别方法,相应技术方案和描述和参见方法部分的相应记载,不再赘述。In addition, the present disclosure also provides a color block recognition device, an electronic device, a computer-readable storage medium, and a program, all of which can be used to implement any color block recognition method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method part and will not be repeated here.

图7示出根据本公开实施例的一种色块识别装置的框图,如图7所示,所述装置70包括:FIG. 7 shows a block diagram of a color block recognition device according to an embodiment of the present disclosure. As shown in FIG. 7 , the device 70 includes:

初始识别模块71,用于对色卡图像进行色块识别,得到识别出的初始色块,所述初始色块为色卡图像的色块中的至少部分色块;An initial recognition module 71 is used to perform color block recognition on the color card image to obtain recognized initial color blocks, where the initial color blocks are at least part of the color blocks in the color card image;

平均尺寸确定模块72,用于确定所述初始色块的平均尺寸;An average size determination module 72, used to determine the average size of the initial color blocks;

矩形框确定模块73,用于根据所述初始色块,确定色卡图像中最外围的色块构成的矩形框;A rectangular frame determination module 73 is used to determine a rectangular frame formed by the outermost color blocks in the color card image according to the initial color blocks;

间距确定模块74,用于基于所述矩形框确定相邻色块之间的间距;A spacing determination module 74, configured to determine the spacing between adjacent color blocks based on the rectangular frame;

位置确定模块75,用于以所述矩形框为基准,根据所述平均尺寸以及相邻色块之间的间距,在所述色卡图像中确定所有色块的位置。The position determination module 75 is used to determine the positions of all color blocks in the color card image based on the rectangular frame and the average size and the distance between adjacent color blocks.

在一种可能的实现方式中,所述初始识别模块,用于将所述色卡图像进行灰度化处理,并对灰度值进行二值化,得到二值化图像;对所述二值化图像进行黑白反转,得到反转图像;在所述反转图像上进行白色轮廓检测,将检测到的白色轮廓的位置作为初始色块的位置。In a possible implementation, the initial recognition module is used to grayscale the color card image and binarize the grayscale values to obtain a binary image; reverse the binary image from black to white to obtain an inverted image; perform white contour detection on the inverted image, and use the position of the detected white contour as the position of the initial color block.

在一种可能的实现方式中,所述平均尺寸确定模块,用于:In a possible implementation, the average size determination module is used to:

将检测到的初始色块的高度相加,并除以初始色块的数目,得到初始色块的平均高度;Add the heights of the detected initial color blocks and divide the sum by the number of initial color blocks to obtain the average height of the initial color blocks;

将检测到的初始色块的宽度相加,并除以初始色块的数目,得到初始色块的平均宽度。The widths of the detected initial color blocks are added together and divided by the number of initial color blocks to obtain the average width of the initial color blocks.

在一种可能的实现方式中,所述平均尺寸确定模块,用于:In a possible implementation, the average size determination module is used to:

剔除初始色块中尺寸最大的色块,对剩余的初始色块的尺寸求平均值,得到初始色块的平均尺寸。The largest color block among the initial color blocks is removed, and the sizes of the remaining initial color blocks are averaged to obtain the average size of the initial color blocks.

在一种可能的实现方式中,所述矩形框确定模块,用于:In a possible implementation, the rectangular frame determination module is used to:

确定各初始色块的中心点坐标;Determine the center point coordinates of each initial color block;

利用所有中心点坐标中水平方向的最小值和最大值,以及垂直方向的最小值和最大值,构建矩形框。Construct a rectangular box using the minimum and maximum values in the horizontal direction, as well as the minimum and maximum values in the vertical direction of all center point coordinates.

在一种可能的实现方式中,所述间距确定模块,用于:In a possible implementation, the distance determination module is used to:

确定所述矩形框的在水平方向上的长度,并除以预设的水平方向的色块数目,得到相邻色块之间的水平间距;Determine the length of the rectangular frame in the horizontal direction, and divide it by the preset number of color blocks in the horizontal direction to obtain the horizontal spacing between adjacent color blocks;

确定所述矩形框的在垂直方向上的长度,并除以预设的垂直方向的色块数目,得到相邻色块之间的垂直间距。The length of the rectangular frame in the vertical direction is determined, and divided by the preset number of color blocks in the vertical direction to obtain the vertical spacing between adjacent color blocks.

在一种可能的实现方式中,所述位置确定模块,用于:In a possible implementation, the location determination module is used to:

确定经过目标顶点的水平框线的斜率,以及竖直框线的斜率;Determine the slope of the horizontal frame line passing through the target vertex, and the slope of the vertical frame line;

将所述目标顶点作为一个色块的中心点位置,并以所述目标顶点为起始点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。The target vertex is taken as the center point of a color block, and the target vertex is taken as the starting point. According to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,所述位置确定模块,用于:In a possible implementation, the location determination module is used to:

确定所述矩形框的四条框线的中点;Determine the midpoints of the four frame lines of the rectangular frame;

连接两条竖直框线的中点,得到水平中线,并连接两条水平框线的中点,得到竖直中线;Connect the midpoints of the two vertical lines to get the horizontal center line, and connect the midpoints of the two horizontal lines to get the vertical center line;

确定所述水平中线的斜率,以及竖直中线的斜率;determining the slope of the horizontal centerline, and the slope of the vertical centerline;

按照所述色卡中色卡的排布规则,以所述水平中线和竖直中线的交点作为色块排布的中心点,按照相邻色块之间的间距,沿所述水平框线的斜率以及竖直框线的斜率,在所述矩形框中依次排列多个色块,得到所述色卡图像中所有色块的位置。According to the arrangement rules of the color cards in the color card, the intersection of the horizontal center line and the vertical center line is used as the center point of the color block arrangement, and according to the spacing between adjacent color blocks, along the slope of the horizontal frame line and the slope of the vertical frame line, multiple color blocks are arranged in sequence in the rectangular frame to obtain the positions of all color blocks in the color card image.

在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:

比例确定模块,用于确定所述矩形框的横纵比例;A ratio determination module, used to determine the horizontal and vertical ratios of the rectangular frame;

所述间距确定模块,用于在所述横纵比例符合预设比例范围的情况下,确定相邻色块之间的间距,所述预设比例范围为预先设置的矩形框的横纵比例的合理范围。The spacing determination module is used to determine the spacing between adjacent color blocks when the horizontal and vertical ratios meet a preset ratio range, and the preset ratio range is a reasonable range of the horizontal and vertical ratios of the preset rectangular frame.

在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述,为了简洁,这里不再赘述。In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是易失性或非易失性计算机可读存储介质。The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.

本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述方法。The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

电子设备可以被提供为终端、服务器或其它形态的设备。The electronic device may be provided as a terminal, a server, or a device in other forms.

图8示出根据本公开实施例的一种电子设备800的框图。例如,电子设备800可以是用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等终端设备。8 shows a block diagram of an electronic device 800 according to an embodiment of the present disclosure. For example, the electronic device 800 may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or other terminal devices.

参照图8,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)接口812,传感器组件814,以及通信组件816。8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input/output (I/O) interface 812 , a sensor component 814 , and a communication component 816 .

处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。I/O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如互补金属氧化物半导体(CMOS)或电荷耦合装置(CCD)图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open/closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration/deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如无线网络(Wi-Fi)、第二代移动通信技术(2G)、第三代移动通信技术(3G)、第四代移动通信技术(4G)、通用移动通信技术的长期演进(LTE)、第五代移动通信技术(5G)或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as a wireless network (Wi-Fi), a second generation mobile communication technology (2G), a third generation mobile communication technology (3G), a fourth generation mobile communication technology (4G), a long-term evolution (LTE) of a universal mobile communication technology, a fifth generation mobile communication technology (5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 804 including computer program instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above method.

本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。The present disclosure may be a system, a method and/or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是(但不限于)电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, (but not limited to) an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.

这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing/processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and/or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and/or edge servers. The network adapter card or network interface in each computing/processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing/processing device.

用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。Various aspects of the present disclosure are described herein with reference to the flowcharts and/or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and/or block diagram and the combination of each box in the flowchart and/or block diagram can be implemented by computer-readable program instructions.

这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions/actions specified in one or more boxes in the flowchart and/or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and/or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions/actions specified in one or more boxes in the flowchart and/or block diagram.

也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions/actions specified in one or more boxes in the flowchart and/or block diagram.

附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and/or flow chart, and the combination of the square boxes in the block diagram and/or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.

上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考,为了简洁,本文不再赘述。The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

若本申请技术方案涉及个人信息,应用本申请技术方案的产品在处理个人信息前,已明确告知个人信息处理规则,并取得个人自主同意。若本申请技术方案涉及敏感个人信息,应用本申请技术方案的产品在处理敏感个人信息前,已取得个人单独同意,并且同时满足“明示同意”的要求。例如,在摄像头等个人信息采集装置处,设置明确显著的标识告知已进入个人信息采集范围,将会对个人信息进行采集,若个人自愿进入采集范围即视为同意对其个人信息进行采集;或者在个人信息处理的装置上,利用明显的标识/信息告知个人信息处理规则的情况下,通过弹窗信息或请个人自行上传其个人信息等方式获得个人授权;其中,个人信息处理规则可包括个人信息处理者、个人信息处理目的、处理方式以及处理的个人信息种类等信息。If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs/information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (11)

1. A color chart identification method, comprising:
performing color lump identification on the color lump image to obtain an identified initial color lump, wherein the initial color lump is at least part of color lump in the color lump image of the color lump;
Determining an average size of the initial color patch;
Determining a rectangular frame formed by the color blocks at the outermost periphery in the color card image according to the initial color blocks, wherein the rectangular frame is a rectangular frame formed by connecting lines of central points of the color blocks at the outermost periphery in the color card image or a rectangular frame formed by connecting lines of vertexes at the same side of the color blocks;
determining a spacing between adjacent color blocks based on the rectangular box;
The rectangular frame is taken as a reference, color blocks with average size are arranged in the rectangular frame at equal intervals according to the average size and the interval between the adjacent color blocks, and the positions of all the color blocks are determined in the color card image;
the determining a spacing between adjacent color blocks based on the rectangular frame includes:
Determining the length of the rectangular frame in the horizontal direction, and dividing the length by the preset number of color blocks in the horizontal direction to obtain the horizontal distance between the adjacent color blocks;
And determining the length of the rectangular frame in the vertical direction, and dividing the length by the preset number of color blocks in the vertical direction to obtain the vertical distance between the adjacent color blocks.
2. The method of claim 1, wherein performing patch recognition on the color chip image to obtain a recognized initial patch comprises:
Carrying out gray scale treatment on the color card image, and carrying out binarization on gray scale values to obtain a binarized image;
Performing black-white inversion on the binarized image to obtain an inverted image;
And performing white contour detection on the inverted image, and taking the position of the detected white contour as the position of the initial color block.
3. The method of claim 1, wherein determining the average size of the initial color block comprises:
adding the detected heights of the initial color blocks, and dividing the heights by the number of the initial color blocks to obtain the average heights of the initial color blocks;
the widths of the detected initial color patches are added and divided by the number of initial color patches to obtain an average width of the initial color patches.
4. The method of claim 1, wherein determining the average size of the initial color block comprises:
And removing the color block with the largest size in the initial color blocks, and averaging the sizes of the rest initial color blocks to obtain the average size of the initial color blocks.
5. The method of claim 1, wherein determining a rectangular box of outermost color patches in the color card image based on the initial color patches, comprises:
Determining the center point coordinates of each initial color block;
And constructing a rectangular frame by utilizing the minimum value and the maximum value in the horizontal direction and the minimum value and the maximum value in the vertical direction in all the center point coordinates.
6. The method of claim 1, wherein determining the locations of all color patches in the color card image based on the average size and the spacing between adjacent color patches based on the rectangular box comprises:
determining the slope of the horizontal wire passing through the target vertex and the slope of the vertical wire;
and taking the target vertex as the center point of one color block, and taking the target vertex as the starting point, and sequentially arranging a plurality of color blocks in the rectangular frame according to the slope of the horizontal frame line and the slope of the vertical frame line and the interval between the adjacent color blocks to obtain the positions of all the color blocks in the color card image.
7. The method of claim 1, wherein determining the locations of all color patches in the color card image based on the average size and the spacing between adjacent color patches based on the rectangular box comprises:
determining the midpoints of four frame wires of the rectangular frame;
Connecting the midpoints of the two vertical frame wires to obtain a horizontal midline, and connecting the midpoints of the two horizontal frame wires to obtain a vertical midline;
determining the slope of the horizontal midline, and the slope of the vertical midline;
According to the arrangement rule of the color cards in the color cards, taking the intersection point of the horizontal central line and the vertical central line as the central point of the color block arrangement, and according to the interval between the adjacent color blocks, sequentially arranging a plurality of color blocks in the rectangular frame along the slope of the horizontal frame line and the slope of the vertical frame line to obtain the positions of all the color blocks in the color card image.
8. The method of claim 5, wherein after determining a rectangular frame formed by a color block at the outermost periphery of the color card image according to the initial color block, the method further comprises:
determining the transverse-longitudinal proportion of the rectangular frame;
The determining the spacing between adjacent color blocks includes:
And under the condition that the transverse and longitudinal proportion accords with a preset proportion range, determining the distance between the adjacent color blocks, wherein the preset proportion range is a reasonable range of the transverse and longitudinal proportion of the preset rectangular frame.
9. A color chart identification device, comprising:
The initial identification module is used for carrying out color lump identification on the color card image to obtain an identified initial color lump, wherein the initial color lump is at least part of color lump in the color lump of the color card image;
An average size determining module, configured to determine an average size of the initial color patch;
The rectangular frame determining module is used for determining a rectangular frame formed by the color blocks at the outermost periphery in the color card image according to the initial color blocks, wherein the rectangular frame is a rectangular frame formed by connecting lines of the central points of the color blocks at the outermost periphery in the color card image or a rectangular frame formed by connecting lines of vertexes at the same side of the color blocks;
A spacing determining module for determining a spacing between adjacent color blocks based on the rectangular frame;
the position determining module is used for arranging color blocks with average size in the rectangular frame at equal intervals according to the average size and the interval between the adjacent color blocks by taking the rectangular frame as a reference, and determining the positions of all the color blocks in the color card image;
The interval determining module is used for:
Determining the length of the rectangular frame in the horizontal direction, and dividing the length by the preset number of color blocks in the horizontal direction to obtain the horizontal distance between the adjacent color blocks;
And determining the length of the rectangular frame in the vertical direction, and dividing the length by the preset number of color blocks in the vertical direction to obtain the vertical distance between the adjacent color blocks.
10. An electronic device, comprising:
A processor;
a memory for storing processor-executable instructions;
Wherein the processor is configured to invoke the instructions stored in the memory to implement the method of any of claims 1 to 8.
11. A computer readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the method of any of claims 1 to 8.
CN202311040900.4A 2023-08-17 2023-08-17 Color card identification method and device, electronic equipment and storage medium Active CN117058255B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311040900.4A CN117058255B (en) 2023-08-17 2023-08-17 Color card identification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311040900.4A CN117058255B (en) 2023-08-17 2023-08-17 Color card identification method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117058255A CN117058255A (en) 2023-11-14
CN117058255B true CN117058255B (en) 2024-07-09

Family

ID=88653101

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311040900.4A Active CN117058255B (en) 2023-08-17 2023-08-17 Color card identification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117058255B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385567A (en) * 2022-12-30 2023-07-04 上海集成电路研发中心有限公司 Method, device and medium for obtaining color card ROI coordinate information

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081802A (en) * 2011-01-26 2011-06-01 北京中星微电子有限公司 Method and device for detecting color card based on block matching
US8983181B2 (en) * 2011-11-28 2015-03-17 Psiflow Technology Inc. Method and system for determining the color of an object in a photo
KR20180136354A (en) * 2017-06-14 2018-12-24 넷마블엔투 주식회사 System and method for providing game service
CN110533732B (en) * 2019-09-04 2021-11-26 厦门美图之家科技有限公司 Method and device for identifying skin color in image, electronic equipment and storage medium
CN115439477B (en) * 2022-11-07 2023-03-28 广东欧谱曼迪科技有限公司 24 color card positioning method and device, electronic equipment and storage medium
CN115761270A (en) * 2022-11-23 2023-03-07 上海闻泰电子科技有限公司 Color card detection method and device, electronic equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385567A (en) * 2022-12-30 2023-07-04 上海集成电路研发中心有限公司 Method, device and medium for obtaining color card ROI coordinate information

Also Published As

Publication number Publication date
CN117058255A (en) 2023-11-14

Similar Documents

Publication Publication Date Title
CN106651955B (en) Method and device for positioning target object in picture
US11443438B2 (en) Network module and distribution method and apparatus, electronic device, and storage medium
WO2017031901A1 (en) Human-face recognition method and apparatus, and terminal
CN106557759B (en) Signpost information acquisition method and device
CN109145970B (en) Image-based question and answer processing method and device, electronic equipment and storage medium
CN108717542B (en) Method, apparatus and computer-readable storage medium for identifying text region
CN106296665A (en) Card image obscures detection method and device
EP2975574A2 (en) Method, apparatus and terminal for image retargeting
WO2023103298A1 (en) Shielding detection method and apparatus, and electronic device, storage medium and computer program product
CN114299056A (en) Defect point recognition method of image and defect image recognition model training method
CN113327290B (en) Binocular module calibration method and device, storage medium and electronic equipment
WO2022095318A1 (en) Character detection method and apparatus, electronic device, storage medium, and program
CN110874809A (en) Image processing method and device, electronic equipment and storage medium
US20150371367A1 (en) Method and terminal device for retargeting images
CN108198148B (en) Method and device for image processing
US12354248B2 (en) Image processing method and apparatus, model training method and apparatus, and storage medium
CN107610201A (en) Lip tattooing method and device based on image procossing
EP4064180A1 (en) Depth of field based creation of a blurred image
WO2022222379A1 (en) Position determination method and apparatus, electronic device and storage medium
CN117058255B (en) Color card identification method and device, electronic equipment and storage medium
CN104851114B (en) A kind of method and terminal for realizing image local discoloration
CN115995091B (en) Method and device for reading flow chart, electronic equipment and storage medium
US12333824B2 (en) Object detection method and apparatus for vehicle, device, vehicle and medium
CN108647594B (en) Information processing method and device
EP3273437A1 (en) Method and device for enhancing readability of a display

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: B655, 4th Floor, Building 14, Cuiwei Zhongli, Haidian District, Beijing, 100036

Patentee after: Mole Thread Intelligent Technology (Beijing) Co.,Ltd.

Country or region after: China

Address before: 209, 2nd Floor, No. 31 Haidian Street, Haidian District, Beijing

Patentee before: Moore Threads Technology Co., Ltd.

Country or region before: China