[go: up one dir, main page]

CN114913070B - A text image splicing method, device, electronic device and storage medium - Google Patents

A text image splicing method, device, electronic device and storage medium Download PDF

Info

Publication number
CN114913070B
CN114913070B CN202210523876.9A CN202210523876A CN114913070B CN 114913070 B CN114913070 B CN 114913070B CN 202210523876 A CN202210523876 A CN 202210523876A CN 114913070 B CN114913070 B CN 114913070B
Authority
CN
China
Prior art keywords
image
target
initial text
gradient
partial
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
CN202210523876.9A
Other languages
Chinese (zh)
Other versions
CN114913070A (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.)
Unisound Intelligent Technology Co Ltd
Original Assignee
Unisound Intelligent 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 Unisound Intelligent Technology Co Ltd filed Critical Unisound Intelligent Technology Co Ltd
Priority to CN202210523876.9A priority Critical patent/CN114913070B/en
Publication of CN114913070A publication Critical patent/CN114913070A/en
Application granted granted Critical
Publication of CN114913070B publication Critical patent/CN114913070B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/32Determination of transform parameters for the alignment of images, i.e. image registration using correlation-based methods

Landscapes

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

Abstract

本申请公开了一种文字图像的拼接方法、装置、电子设备及存储介质。本申请首先获取待拼接的初始文字图像,并对初始文字图像进行灰度化处理,得到初始文字图像对应的灰度图像。其次,获取初始文字图像对应的目标梯度图像,以及获取灰度图像对应的目标投影图像;然后再将灰度图像、梯度图像以及投影图像分别与初始文字图像进行相关性匹配,并基于匹配到的目标像素点进行图像拼接。以此利用各种图像所携带的不同特性进行相关性匹配,能够准确的捕获到满足数量的像素点,实现了在复杂条件货背景下准确进行拼图。同时相比传统的图像拼接方法计算量小,拼接效率高。

The present application discloses a text image stitching method, device, electronic device and storage medium. The present application first obtains the initial text image to be stitched, and grayscales the initial text image to obtain a grayscale image corresponding to the initial text image. Secondly, obtain the target gradient image corresponding to the initial text image, and obtain the target projection image corresponding to the grayscale image; then, the grayscale image, the gradient image and the projection image are respectively matched with the initial text image for correlation, and the image is stitched based on the matched target pixel points. In this way, by utilizing the different characteristics carried by various images for correlation matching, a sufficient number of pixels can be accurately captured, and accurate stitching under complex conditions or backgrounds can be achieved. At the same time, compared with traditional image stitching methods, the amount of calculation is small and the stitching efficiency is high.

Description

Text image stitching method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a text image stitching method, a text image stitching device, an electronic device, and a storage medium.
Background
The prior art of image mosaicing (registration) based on feature key point matching can be roughly divided into two types, namely, image mosaicing (registration) based on feature key point matching is mainly performed by using an overlapping region and an overlapping position between images to be mosaiced. The method comprises the steps of (1) detecting characteristic points in each image, (2) calculating matching relations among the characteristic points, (3) calculating a conversion matrix among the images to be spliced through the matching points, wherein the two images are in the same coordinate system, and (4) fusing the spliced images and processing image boundaries to finish splicing.
And (II) a method based on image characteristic correlation. And according to the higher correlation of the overlapping areas of the two images to be spliced, the splicing of the images is realized by searching the overlapping areas of the two images, such as template matching.
The image stitching method based on characteristic key point matching, such as an SURF-based image stitching method, an ORB-based image stitching method and the like, has the problems that the method needs to extract the characteristics of an image first, then detect the characteristic points (key points) of the image, then perform the steps of characteristic point matching and the like so as to stitch the image, then the steps of characteristic extraction, characteristic point matching and the like need a large amount of calculation, the time consumption is high, and real-time operation under the stippling force is difficult to achieve.
Moreover, for text pictures, the resolution ratio is generally lower, the content is only text, the feature points are fewer, and it is difficult to accurately capture the feature point matching pairs meeting the number, which often affects the normal implementation of the jigsaw and reduces the accuracy of the jigsaw.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the application provides a text image splicing method, a text image splicing device, electronic equipment and a storage medium.
According to an aspect of the embodiment of the present application, there is provided a text image stitching method, including:
Acquiring an initial text image to be spliced, and carrying out gray-scale processing on the initial text image to obtain a gray-scale image corresponding to the initial text image;
Acquiring a target gradient image corresponding to the initial character image and a target projection image corresponding to the gray level image;
Performing correlation matching on the gray level image, the target gradient image and the target projection image and the initial character image respectively to obtain target pixel points matched with the initial character image in the gray level image, the target gradient image and the target projection image respectively;
and splicing based on the target pixel points to obtain a target text image.
Further, the obtaining the target gradient image corresponding to the initial text image includes:
acquiring a first gradient image of the initial text image in the ordinate direction and a second gradient image of the initial text image in the abscissa direction;
the first gradient image and the second gradient image are determined as the target gradient image.
Further, the obtaining the target projection image corresponding to the gray level image includes:
And determining a projection image of the gray image in the abscissa direction as the target projection image.
Further, the performing correlation matching on the gray level image, the target gradient image and the target projection image with the initial text image to obtain target pixel points in the gray level image, the target gradient image and the target projection image, which are respectively matched with the initial text image, includes:
Acquiring a first local image set extracted from the gray level image, the target gradient image and the target projection image according to a plurality of different preset lengths, wherein the first local image set comprises local images extracted from the gray level image, the target gradient image and the target projection image according to each preset length;
acquiring a second local image set extracted from the initial text image according to a plurality of different preset lengths, wherein the second local image set comprises local images extracted from the initial text image according to each preset length;
And comparing the correlation between the local images in the first local image set and the local images in the second local image set under each preset length to obtain the target pixel point.
Further, the acquiring a first local image set respectively extracted from the gray level image, the target gradient image and the target projection image according to a plurality of different preset lengths includes:
Selecting a first local image from the gray level image, the target gradient image and the target projection image according to a first preset length;
Calculating a sum value between a first preset length and a plurality of step sizes arranged in a gradient manner, and determining the sum value as a second preset length;
Selecting a second local image according to the gray level image, the target gradient image and the target projection image respectively according to the second preset length;
the first set of partial images is derived based on the first partial image and the second partial image.
Further, the obtaining a second local image set extracted from the initial text image according to a plurality of different preset lengths includes:
selecting a third partial image from the initial text image according to a first preset length;
Calculating a sum value between a first preset length and a plurality of step sizes arranged in a gradient manner, and determining the sum value as a second preset length;
Selecting a fourth partial image from the initial text images according to the second preset length;
the second set of partial images is derived based on the third partial image and the fourth partial image.
Further, the comparing the correlation between the local image in the first local image set and the local image in the second local image set under each preset length to obtain the target pixel point includes:
comparing the correlation between the local images in the first local image set and the second local image set under each preset length to obtain candidate pixel points in each image under each preset length;
acquiring confidence degrees corresponding to the gray level image, the target gradient image, the target projection image and the initial text image respectively;
And calculating frequency data corresponding to each candidate pixel point based on the confidence coefficient, and determining the candidate pixel point with the highest frequency data as the target pixel point.
According to another aspect of the embodiment of the present application, there is also provided a text image stitching apparatus, including:
The first acquisition module is used for acquiring initial text images to be spliced, and carrying out gray-scale processing on the initial text images to obtain gray-scale images corresponding to the initial text images;
The second acquisition module is used for acquiring a target gradient image corresponding to the initial character image and acquiring a projection image corresponding to the gray level image;
the processing module is used for performing image correlation matching on the gray level image, the target gradient image and the projection image and the initial text image respectively to obtain target pixel points matched with the initial text image in the gray level image, the target gradient image and the projection image respectively;
And the splicing module is used for splicing based on the target pixel points to obtain a target text image.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that performs the above steps when running.
According to another aspect of the embodiment of the application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus, where the memory is used to store a computer program, and the processor is used to execute the steps in the above method by running the program stored on the memory.
Embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the above method.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the advantages that the method provided by the embodiment of the application carries out correlation matching on the gray level image, the gradient image and the projection image with the initial text image respectively, and carries out image stitching based on the matched target pixel points. The correlation matching is carried out by utilizing different characteristics carried by various images, so that the pixel points meeting the quantity can be accurately captured, and the accurate jigsaw under the complex condition goods background is realized. Meanwhile, compared with the traditional image splicing method, the method has the advantages of small calculated amount and high splicing efficiency.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a text image stitching method according to an embodiment of the present application;
FIG. 2 is a flowchart of a text image stitching method according to another embodiment of the present application;
FIG. 3 is a flowchart of a text image stitching method according to another embodiment of the present application;
Fig. 4 is a block diagram of a text image stitching device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments, illustrative embodiments of the present application and descriptions thereof are used to explain the present application and do not constitute undue limitations of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another similar entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The embodiment of the application provides a text image splicing method, a text image splicing device, electronic equipment and a storage medium. The method provided by the embodiment of the application can be applied to any needed electronic equipment, for example, the electronic equipment can be a server, a terminal and the like, is not particularly limited, and is convenient to describe and is called as the electronic equipment for short hereinafter.
According to an aspect of the embodiment of the present application, a method embodiment of a text image stitching method is provided, and fig. 1 is a flowchart of a method provided by the embodiment of the present application, as shown in fig. 1, where the method includes:
Step S11, obtaining an initial character image to be spliced, and carrying out gray processing on the initial character image to obtain a gray image corresponding to the initial character image.
The method provided by the embodiment of the application is applied to the intelligent terminal, and the intelligent terminal can be equipment such as a smart phone, a notebook computer, a tablet personal computer and the like. Specifically, the process of the intelligent terminal obtaining the initial text image to be spliced may be that the requester device sends the initial text image to the intelligent terminal according to its own processing requirement. Or the user directly uploads the initial text image on the intelligent terminal.
In the embodiment of the application, after the initial text image is obtained, the intelligent terminal performs gray processing on the initial text image to obtain a gray image corresponding to the initial text image, and the gray image is recorded as a gray image P1.
Step S12, obtaining a target gradient image corresponding to the initial character image and obtaining a target projection image corresponding to the gray level image.
In the embodiment of the application, the target gradient image corresponding to the initial text image is obtained, which comprises the following steps of A1-A2:
Step A1, a first gradient image of an initial character image in the ordinate direction and a second gradient image of the initial character image in the abscissa direction are obtained.
And step A2, determining the first gradient image and the second gradient image as target gradient images.
In the embodiment of the application, the initial text image can be regarded as a two-dimensional discrete function, and the process of the first gradient image of the initial text image in the ordinate direction is that the first gradient image in the ordinate direction is obtained by calculating the ordinate of the pixel point in the initial text image by utilizing the two-dimensional discrete function. Similarly, the two-dimensional discrete function and the abscissa of the pixel point in the initial text image are utilized for calculation, and the obtained calculation result is the second gradient image in the abscissa direction. The first gradient image and the second gradient image are taken as target gradient images, the first gradient image is denoted as P2, and the second gradient image is denoted as P3.
In the embodiment of the application, the acquisition of the target projection image corresponding to the gray image comprises the step of determining the projection image of the gray image in the abscissa direction as the target projection image. The target projection image is denoted as P4.
The gray level image can well retain the information of the original image, the gradient image in the abscissa direction can highlight the features in the abscissa direction, the gradient image in the ordinate direction can highlight the features in the ordinate direction, and the features of noise, which are used for highlighting characters, can be removed, so that the image matching is more accurate. The projection image can reflect that the statistical characteristics of the pixels of the image have good robustness of character deformation, so that matching errors caused by the character deformation due to picture distortion can be reduced, and misjudgment of matching caused by a plurality of repeated overlapping areas can be reduced. Therefore, the embodiment of the application provides a reliable basis for carrying out correlation matching on the follow-up images by acquiring the four images.
And step S13, respectively performing correlation matching on the gray level image, the target gradient image and the target projection image and the initial character image to obtain target pixel points in the gray level image, the target gradient image and the target projection image, which are respectively matched with the initial character image.
In the embodiment of the present application, step S13, performing correlation matching on a gray image, a target gradient image and a target projection image with an initial text image, to obtain target pixel points in the gray image, the target gradient image and the target projection image, which are respectively matched with the initial text image, includes the following steps B1-B3:
And B1, acquiring a first local image set which is respectively extracted from the gray level image, the target gradient image and the target projection image according to a plurality of different preset lengths, wherein the first local image set comprises local images which are extracted from the gray level image, the target gradient image and the target projection image according to each preset length.
In the embodiment of the present application, step B1, obtaining a first local image set extracted from a gray image, a target gradient image and a target projection image according to a plurality of different preset lengths, includes the following steps B101-B104:
And step B101, selecting a first local image from the gray level image, the target gradient image and the target projection image according to a first preset length.
And step B102, calculating the sum value between the first preset length and a plurality of step sizes arranged in a gradient manner, and determining the sum value as a second preset length.
And step B103, selecting a second local image according to the gray level image, the target gradient image and the target projection image respectively with a second preset length.
Step B104, obtaining a first local image set based on the first local image and the second local image.
In the embodiment of the application, first, a first partial image with a length t is selected from the left edges of the gray-scale image P1, the first gradient image P2, the second gradient image P3 and the target projection image P4, wherein the first partial image includes a partial image Q1 of the gray-scale image P1, a partial image Q2 of the first gradient image, a partial image Q3 of the second gradient image and a partial image Q4 of the target projection image.
Secondly, calculating the sum value between the first preset length and a plurality of step sizes arranged in a gradient way, wherein the sum value can be t+s, t+2s and the like. The second preset length includes t+s, t+2s, t+3s. Then, partial images with the length of t+s are selected from the left edges of the gray scale image P1, the first gradient image P2, the second gradient image P3 and the target projection image P4, partial images with the length of t+2s are selected from the left edges of the gray scale image P1, the first gradient image P2, the second gradient image P3 and the target projection image P4, and then the partial images with the length of t+s and the partial images with the length of t+2s are used as second partial images. A first local image set is obtained based on the first local image and the second local image.
And B2, acquiring a second local image set extracted from the initial text image according to a plurality of different preset lengths, wherein the second local image set comprises local images extracted from the initial text image according to each preset length.
In the embodiment of the present application, step B2, obtaining a second local image set extracted from an initial text image according to a plurality of different preset lengths, includes the following steps B201 to B204:
And step B201, selecting a third partial image from the initial text images according to the first preset length.
And step B202, calculating the sum value between the first preset length and a plurality of step sizes arranged in a gradient manner, and determining the sum value as a second preset length.
And step B203, selecting a fourth partial image from the initial text images according to the second preset length.
Step B204, obtaining a second local image set based on the third local image and the fourth local image.
In the embodiment of the application, first, the third partial images with the length t are selected from the left edge of the initial text image respectively. Secondly, calculating the sum value between the first preset length and a plurality of step sizes arranged in a gradient way, wherein the sum value can be t+s, t+2s and the like. The second preset length comprises t+s and t+2s. Then, a partial image with the length of t+s is selected from the left edge of the initial character image, a partial image with the length of t+2s is selected from the left edge of the initial character image, and then the partial image with the length of t+s and the partial image with the length of t+2s are used as fourth partial images. A second set of partial images is obtained based on the third partial image and the fourth partial image.
And B3, comparing the correlation between the local images in the first local image set and the local images in the second local image set under each preset length to obtain target pixel points.
In the embodiment of the present application, step B3, comparing the correlation between the partial images in the first partial image set and the partial images in the second partial image set under each preset length to obtain the target pixel point, includes the following steps B301-B303:
Step B301, comparing the correlation between the local images in the first local image set and the local images in the second local image set under each preset length to obtain candidate pixel points in each image under each preset length;
and step B302, obtaining the confidence degrees respectively corresponding to the gray level image, the target gradient image, the target projection image and the initial text image.
And step B303, calculating frequency data corresponding to each candidate pixel point based on the confidence coefficient, and determining the candidate pixel point with the highest frequency data as a target pixel point.
As an example, a first partial image in the first partial image set is compared with a third partial image in the corresponding second partial image set by correlation, and a pixel point having the greatest correlation among the partial image Q1 of the grayscale image P1, the partial image Q2 of the first gradient image, the partial image Q3 of the second gradient image, and the partial image Q4 of the target projection image is used as a first candidate pixel point, and the first candidate pixel point includes a pixel point A1 (XA 1, YA 1) in the partial image Q1, a pixel point B1 (XB 1, YB 1) in the partial image Q1, a pixel point C1 (XC 1, YC 1) in the partial image Q1, and a pixel point D1 (XD 1, YD 1) in the partial image Q1.
And secondly, performing correlation comparison on the partial images with the preset length of t+s in the first partial image set and the partial images with the preset length of t+s in the er partial image set respectively to obtain second candidate pixel points including a pixel point A2 (XA 2 and YA 2), a pixel point B2 (XB 2 and YB 2), a pixel point C2 (XC 2 and YC 2) and a pixel point D2 (XD 2 and YD 2).
The above-described processes were repeated to obtain (XA 3, YA 3), (XB 3, YB 3), (XC 3, YC 3), (XD 3, YD 3), (XA 4, YA 4), (XB 4, YB 4), (XC 4, YC 4), (XD 4, YD 4).
For the obtained plurality of candidate pixel points (XA 1, YA 1), (XB 1, YB 1), (XC 1, YC 1), (XD 1, YD 1), (XA 2, YA 2), (XB 2, YB 2), (XC 2, YC 2), (XD 2, YD 2)..a, B, C, D four pixel points are respectively from matching of gray scale image, first gradient image, second gradient image and projection image, because the image quality of the four images is different, the confidence of the four images is set to be a, B, C, D, the weighted frequency of occurrence of the candidate pixel points is calculated according to the confidence, the point with the highest frequency is the global optimal matching point (namely the target pixel point), and if the matching point is less or no repeated matching point, the global optimal point (target pixel point) is calculated in a weighted clustering mode.
The embodiment of the application utilizes the gray level image, the gradient image in the horizontal coordinate direction, the gradient image in the vertical coordinate direction and the projection image, and according to different confidence degrees of each image device, the best matching point is searched according to the weighting frequency or the clustering to realize the jigsaw, thereby ensuring the accuracy of the result and realizing the robustness of the result under the condition of low calculation force requirement.
And S14, splicing based on the target pixel points to obtain a target text image.
In the embodiment of the application, after the target pixel point is obtained, the text image can be spliced according to the optimal matching point.
According to the method provided by the embodiment of the application, the gray level image, the gradient image and the projection image are respectively subjected to correlation matching with the initial text image, and the image stitching is performed based on the matched target pixel points. The correlation matching is carried out by utilizing different characteristics carried by various images, so that the pixel points meeting the quantity can be accurately captured, and the accurate jigsaw under the complex condition goods background is realized. Meanwhile, compared with the traditional image splicing method, the method has the advantages of small calculated amount and high splicing efficiency.
Fig. 4 is a block diagram of a text image stitching device according to an embodiment of the present application, where the text image stitching device may be implemented as part or all of an electronic device through software, hardware, or a combination of both. As shown in fig. 4, the apparatus includes:
the first obtaining module 41 is configured to obtain an initial text image to be stitched, and perform graying processing on the initial text image to obtain a gray image corresponding to the initial text image;
a second obtaining module 42, configured to obtain a target gradient image corresponding to the initial text image, and obtain a projection image corresponding to the gray scale image;
The processing module 43 is configured to perform image correlation matching on the gray level image, the target gradient image, and the projection image with the initial text image, so as to obtain target pixel points in the gray level image, the target gradient image, and the projection image, which are respectively matched with the initial text image;
And the stitching module 44 is configured to stitch based on the target pixel point to obtain a target text image.
In the embodiment of the present application, the second obtaining module 42 is configured to obtain a first gradient image of the initial text image in the ordinate direction and a second gradient image of the initial text image in the abscissa direction, and determine the first gradient image and the second gradient image as the target gradient image.
In the embodiment of the present application, the second obtaining module 42 is configured to determine a projection image of the gray-scale image in the abscissa direction as the target projection image.
In the embodiment of the application, the processing module 43 is configured to obtain a first local image set extracted from the gray image, the target gradient image and the target projection image according to a plurality of different preset lengths, where the first local image set includes local images extracted from the gray image, the target gradient image and the target projection image according to each preset length, obtain a second local image set extracted from the initial text image according to a plurality of different preset lengths, where the second local image set includes local images extracted from the initial text image according to each preset length, and compare correlations between local images in the first local image set and local images in the second local image set under each preset length to obtain the target pixel.
In the embodiment of the present application, the processing module 43 is configured to select a first local image from the gray-scale image, the target gradient image, and the target projection image according to a first preset length;
the method comprises the steps of calculating the sum value between a first preset length and a plurality of step sizes which are arranged in a gradient mode, determining the sum value as a second preset length, selecting a second local image according to the gray level image, the target gradient image and the target projection image of the second preset length, and obtaining a first local image set based on the first local image and the second local image.
In the embodiment of the application, the processing module 43 is configured to select a third partial image from the initial text image according to a first preset length, calculate a sum value between the first preset length and a plurality of step sizes arranged in a gradient manner, determine the sum value as a second preset length, select a fourth partial image from the initial text image according to the second preset length, and obtain a second partial image set based on the third partial image and the fourth partial image.
In the embodiment of the application, the processing module 43 is configured to compare the correlation between the partial images in the first partial image set and the partial images in the second partial image set under each preset length to obtain candidate pixel points in each image under each preset length, obtain confidence levels corresponding to the gray level image, the target gradient image, the target projection image and the initial text image respectively, calculate frequency data corresponding to each candidate pixel point based on the confidence levels, and determine the candidate pixel point with the highest frequency data as the target pixel point.
The embodiment of the application also provides an electronic device, as shown in fig. 5, where the electronic device may include a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, where the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the above embodiments.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or may include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central Processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), a digital signal processor (DIGITAL SIGNAL Processing, DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In yet another embodiment of the present application, a computer readable storage medium is provided, where instructions are stored, which when executed on a computer, cause the computer to perform the method for stitching text images according to any one of the above embodiments.
In yet another embodiment of the present application, a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method for stitching text images according to any of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk Solid STATE DISK), etc.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
The foregoing is only a specific embodiment of the application to enable those skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1.一种文字图像的拼接方法,其特征在于,包括:1. A text image splicing method, characterized by comprising: 获取待拼接的初始文字图像,并对所述初始文字图像进行灰度化处理,得到所述初始文字图像对应的灰度图像;Acquire an initial text image to be spliced, and perform grayscale processing on the initial text image to obtain a grayscale image corresponding to the initial text image; 获取所述初始文字图像对应的目标梯度图像,以及获取所述灰度图像对应的目标投影图像;Acquire a target gradient image corresponding to the initial text image, and acquire a target projection image corresponding to the grayscale image; 将所述灰度图像、目标梯度图像以及所述目标投影图像分别与所述初始文字图像进行相关性匹配,得到灰度图像、目标梯度图像以及所述目标投影图像中分别与所述初始文字图像匹配的目标像素点;Correlation matching is performed on the grayscale image, the target gradient image, and the target projection image with the initial text image to obtain target pixel points in the grayscale image, the target gradient image, and the target projection image that match the initial text image respectively; 基于所述目标像素点进行拼接,得到目标文字图像。The target text image is obtained by performing stitching based on the target pixel points. 2.根据权利要求1所述的方法,其特征在于,所述获取所述初始文字图像对应的目标梯度图像,包括:2. The method according to claim 1, characterized in that the step of obtaining a target gradient image corresponding to the initial text image comprises: 获取所述初始文字图像在纵坐标方向上的第一梯度图像,以及所述初始文字图像在横坐标方向上的第二梯度图像;Acquire a first gradient image of the initial text image in the ordinate direction, and a second gradient image of the initial text image in the abscissa direction; 将所述第一梯度图像和所述第二梯度图像确定为所述目标梯度图像。The first gradient image and the second gradient image are determined as the target gradient images. 3.根据权利要求1所述的方法,其特征在于,所述获取所述灰度图像对应的目标投影图像,包括:3. The method according to claim 1, characterized in that the step of obtaining a target projection image corresponding to the grayscale image comprises: 将所述灰度图像在横坐标方向上的投影图像,确定为所述目标投影图像。The projection image of the grayscale image in the horizontal coordinate direction is determined as the target projection image. 4.根据权利要求1所述的方法,其特征在于,所述将所述灰度图像、目标梯度图像以及所述目标投影图像分别与所述初始文字图像进行相关性匹配,得到灰度图像、目标梯度图像以及所述目标投影图像中分别与所述初始文字图像匹配的目标像素点,包括:4. The method according to claim 1, characterized in that the step of performing correlation matching on the grayscale image, the target gradient image, and the target projection image with the initial text image to obtain target pixel points in the grayscale image, the target gradient image, and the target projection image that match the initial text image, respectively, comprises: 获取按照多个不同预设长度分别从所述灰度图像、目标梯度图像以及所述目标投影图像中提取的第一局部图像集合,其中,所述第一局部图像集合中包括:按照每个预设长度从所述灰度图像、目标梯度图像以及所述目标投影图像中提取的局部图像;Acquire a first set of partial images extracted from the grayscale image, the target gradient image, and the target projection image according to a plurality of different preset lengths, wherein the first set of partial images includes: partial images extracted from the grayscale image, the target gradient image, and the target projection image according to each preset length; 获取按照多个不同预设长度从所述初始文字图像中提取的第二局部图像集合,其中,所述第二局部图像集合中包括:按照每个预设长度从初始文字图像中提取的局部图像;Acquire a second set of partial images extracted from the initial text image according to a plurality of different preset lengths, wherein the second set of partial images includes: partial images extracted from the initial text image according to each preset length; 对比每个预设长度下的第一局部图像集合中的局部图像与所述第二局部图像集合中的局部图像之间的相关性,得到所述目标像素点。The target pixel point is obtained by comparing the correlation between the local images in the first local image set and the local images in the second local image set at each preset length. 5.根据权利要求4所述的方法,其特征在于,所述获取按照多个不同预设长度分别从所述灰度图像、目标梯度图像以及所述目标投影图像中提取的第一局部图像集合,包括:5. The method according to claim 4, characterized in that the step of obtaining a first set of partial images extracted from the grayscale image, the target gradient image, and the target projection image according to a plurality of different preset lengths comprises: 按照第一预设长度分别从所述灰度图像、目标梯度图像以及所述目标投影图像选取第一局部图像;Selecting a first partial image from the grayscale image, the target gradient image, and the target projection image respectively according to a first preset length; 计算第一预设长度与多个呈梯度排列的步长之间的和值,并将所述和值确定为第二预设长度;Calculating a sum of a first preset length and a plurality of step lengths arranged in a gradient, and determining the sum as a second preset length; 按照所述第二预设长度分别所述所述灰度图像、目标梯度图像以及所述目标投影图像选取第二局部图像;Selecting a second partial image from the grayscale image, the target gradient image, and the target projection image according to the second preset length; 基于所述第一局部图像和所述第二局部图像得到所述第一局部图像集合。The first partial image set is obtained based on the first partial image and the second partial image. 6.根据权利要求4所述的方法,其特征在于,所述获取按照多个不同预设长度从所述初始文字图像中提取的第二局部图像集合,包括:6. The method according to claim 4, characterized in that the step of obtaining a second set of partial images extracted from the initial text image according to a plurality of different preset lengths comprises: 按照第一预设长度从所述初始文字图像中选取第三局部图像;Selecting a third partial image from the initial text image according to a first preset length; 计算第一预设长度与多个呈梯度排列的步长之间的和值,并将所述和值确定为第二预设长度;Calculating a sum of a first preset length and a plurality of step lengths arranged in a gradient, and determining the sum as a second preset length; 按照所述第二预设长度从所述初始文字图像中选取第四局部图像;Selecting a fourth partial image from the initial text image according to the second preset length; 基于所述第三局部图像和所述第四局部图像得到所述第二局部图像集合。The second partial image set is obtained based on the third partial image and the fourth partial image. 7.根据权利要求4所述的方法,其特征在于,所述对比每个预设长度下的第一局部图像集合中的局部图像与所述第二局部图像集合中的局部图像之间的相关性,得到所述目标像素点,包括:7. The method according to claim 4, characterized in that the step of comparing the correlation between the local images in the first local image set and the local images in the second local image set at each preset length to obtain the target pixel point comprises: 对比每个预设长度下的第一局部图像集合中的局部图像与所述第二局部图像集合中的局部图像之间的相关性,得到每个预设长度对应下各个图像中的候选像素点;Comparing the correlation between the local images in the first local image set at each preset length and the local images in the second local image set, to obtain candidate pixel points in each image corresponding to each preset length; 获取所述灰度图像、目标梯度图像、所述目标投影图像以及所述初始文字图像分别对应的置信度;Obtaining confidences corresponding to the grayscale image, the target gradient image, the target projection image, and the initial text image respectively; 基于所述置信度计算各个候选像素点对应的频次数据,将频次数据最高的候选像素点确定为所述目标像素点。The frequency data corresponding to each candidate pixel is calculated based on the confidence level, and the candidate pixel with the highest frequency data is determined as the target pixel. 8.一种文字图像的拼接装置,其特征在于,包括:8. A text image splicing device, characterized by comprising: 第一获取模块,用于获取待拼接的初始文字图像,并对所述初始文字图像进行灰度化处理,得到所述初始文字图像对应的灰度图像;A first acquisition module is used to acquire an initial text image to be spliced, and grayscale the initial text image to obtain a grayscale image corresponding to the initial text image; 第二获取模块,用于获取所述初始文字图像对应的目标梯度图像,以及获取所述灰度图像对应的投影图像;A second acquisition module, used to acquire a target gradient image corresponding to the initial text image, and to acquire a projection image corresponding to the grayscale image; 处理模块,用于将所述灰度图像、目标梯度图像以及所述投影图像分别与所述初始文字图像进行图像相关性匹配,得到灰度图像、目标梯度图像以及所述投影图像中分别与所述初始文字图像匹配的目标像素点;A processing module, used for performing image correlation matching on the grayscale image, the target gradient image and the projection image with the initial text image, respectively, to obtain target pixel points in the grayscale image, the target gradient image and the projection image that match the initial text image respectively; 拼接模块,用于基于所述目标像素点进行拼接,得到目标文字图像。The splicing module is used to perform splicing based on the target pixel points to obtain a target text image. 9.一种存储介质,其特征在于,所述存储介质包括存储的程序,其中,所述程序运行时执行上述权利要求1至7中任一项所述的方法步骤。9. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program executes the method steps described in any one of claims 1 to 7 when it is run. 10.一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;其中:10. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: 存储器,用于存放计算机程序;Memory, used to store computer programs; 处理器,用于通过运行存储器上所存放的程序来执行权利要求1至7中任一项所述的方法步骤。A processor, configured to execute the method steps of any one of claims 1 to 7 by running a program stored in a memory.
CN202210523876.9A 2022-05-14 2022-05-14 A text image splicing method, device, electronic device and storage medium Active CN114913070B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210523876.9A CN114913070B (en) 2022-05-14 2022-05-14 A text image splicing method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210523876.9A CN114913070B (en) 2022-05-14 2022-05-14 A text image splicing method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN114913070A CN114913070A (en) 2022-08-16
CN114913070B true CN114913070B (en) 2025-01-03

Family

ID=82765836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210523876.9A Active CN114913070B (en) 2022-05-14 2022-05-14 A text image splicing method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114913070B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109887002A (en) * 2019-02-01 2019-06-14 广州视源电子科技股份有限公司 Image feature point matching method and device, computer equipment and storage medium
CN114494013A (en) * 2022-01-18 2022-05-13 杭州海康威视数字技术股份有限公司 Image splicing method, device, equipment and medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018133027A1 (en) * 2017-01-20 2018-07-26 深圳大学 Grayscale constraint-based method and apparatus for integer-pixel search for three-dimensional digital speckle pattern

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109887002A (en) * 2019-02-01 2019-06-14 广州视源电子科技股份有限公司 Image feature point matching method and device, computer equipment and storage medium
CN114494013A (en) * 2022-01-18 2022-05-13 杭州海康威视数字技术股份有限公司 Image splicing method, device, equipment and medium

Also Published As

Publication number Publication date
CN114913070A (en) 2022-08-16

Similar Documents

Publication Publication Date Title
CN111832535B (en) Face recognition method and device
US11393200B2 (en) Hybrid feature point/watermark-based augmented reality
US9036905B2 (en) Training classifiers for deblurring images
CN102792317B (en) Based on the Image Feature Detection of the application of multiple property detector
US9691004B2 (en) Device and method for service provision according to prepared reference images to detect target object
CN111460355B (en) Page analysis method and device
US9025889B2 (en) Method, apparatus and computer program product for providing pattern detection with unknown noise levels
CN112767354B (en) Defect detection method, device, equipment and storage medium based on image segmentation
CN111291661A (en) Method and equipment for identifying text content of icons in screen
JP2017130929A (en) Correction method and correction device for document image acquired by imaging apparatus
CN106326802B (en) Quick Response Code bearing calibration, device and terminal device
CN110766007B (en) Certificate shielding detection method, device, equipment and readable storage medium
CN112102404B (en) Object detection tracking method and device and head-mounted display equipment
CN112396057B (en) Character recognition method, device and electronic equipment
CN107644105A (en) Question searching method and device
CN113033542A (en) Method and device for generating text recognition model
CN110853115B (en) Creation method and device of development flow page
CN112036342A (en) Document snapshot method, device and computer storage medium
CN118823837B (en) Fingerprint image matching and recognition method, device, electronic device and storage medium
JP6171660B2 (en) Information processing apparatus, information processing system, and program
CN114913070B (en) A text image splicing method, device, electronic device and storage medium
CN113408553B (en) Image category recognition method, device, electronic device and storage device
CN113223184A (en) Image processing method and device, electronic equipment and storage medium
CN113129298A (en) Definition recognition method of text image
CN114819142B (en) Screen shooting image recognition and training method and device for models thereof and electronic equipment

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