CN107818323B - Method and apparatus for processing image - Google Patents

Method and apparatus for processing image Download PDF

Info

Publication number
CN107818323B
CN107818323B CN201711163973.7A CN201711163973A CN107818323B CN 107818323 B CN107818323 B CN 107818323B CN 201711163973 A CN201711163973 A CN 201711163973A CN 107818323 B CN107818323 B CN 107818323B
Authority
CN
China
Prior art keywords
contour
character
local
target image
regions
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
CN201711163973.7A
Other languages
Chinese (zh)
Other versions
CN107818323A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201711163973.7A priority Critical patent/CN107818323B/en
Publication of CN107818323A publication Critical patent/CN107818323A/en
Application granted granted Critical
Publication of CN107818323B publication Critical patent/CN107818323B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application discloses a method and a device for processing an image. One embodiment of the method comprises: extracting the outline of the target image; dividing the outline of the target image into regions to obtain at least two regions; for the local contour presented in each area, searching for a character matched with the local contour; and arranging each character into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located. The method provided by the embodiment of the application enriches available resources when the user uses the chatting tool to chat.

Description

Method and apparatus for processing image
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to the technical field of internet, and particularly relates to a method and a device for processing images.
Background
With the popularization of the mobile internet, the frequency of using the chat tool by the user is gradually increasing. In the process of chatting, the user can select the emoticon in the chatting interface and send the emoticon to the chatting object.
Disclosure of Invention
The embodiment of the application provides a data acquisition method and device for a server.
In a first aspect, an embodiment of the present application provides a method for processing an image, including: extracting the outline of the target image; dividing the outline of the target image into regions to obtain at least two regions; for the local contour presented in each area, searching for a character matched with the local contour; and arranging the characters into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
In some embodiments, for a local contour presented in each region, finding a character matching the local contour comprises: for the local contour presented in each region, a character matching the shape of the local contour is found in a preset character set.
In some embodiments, extracting the contour of the target image comprises: and carrying out contour detection on the target image to generate a contour of the target image, wherein the contour comprises a peripheral contour and an internal contour.
In some embodiments, for a local contour presented in each region, finding a character matching the local contour comprises: for the local contour presented in each region, comparing the local contour with more than one character in a preset character set to determine the shape similarity of the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as the character that matches the local outline.
In some embodiments, the method further comprises: and sending the character picture to terminal equipment, wherein the terminal equipment sends the target image uploaded by the user in response to the received preset operation of the user on the target sub-area in the expression picture selection area.
In a second aspect, an embodiment of the present application provides an apparatus for processing an image, including: an extraction unit configured to extract a contour of a target image; the dividing unit is configured for dividing the outline of the target image into at least two areas; the searching unit is configured to search a character matched with the local contour for the local contour presented in each area; and the arrangement unit is configured to arrange each character into a character drawing of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
In some embodiments, the lookup unit is further configured to: for the local contour presented in each region, a character matching the shape of the local contour is found in a preset character set.
In some embodiments, the extraction unit is further configured to: and carrying out contour detection on the target image to generate a contour of the target image, wherein the contour comprises a peripheral contour and an internal contour.
In some embodiments, the lookup unit is further configured to: for the local contour presented in each region, comparing the local contour with more than one character in a preset character set to determine the shape similarity of the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as the character that matches the local outline.
In some embodiments, the apparatus further comprises: and the sending unit is configured to send the character picture to the terminal equipment, wherein the terminal equipment sends the target image uploaded by the user in response to receiving the preset operation of the user on the target sub-area in the expression map selection area.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method as in any embodiment of a method for processing images.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium on which a computer program is stored, which when executed by a processor, implements a method as in any one of the embodiments of the method for processing an image.
According to the method and the device for processing the image, the outline of the target image is extracted firstly. Then, the contour of the target image is divided into at least two regions. Then, for the local contour presented in each region, the character matching the local contour is found. And finally, arranging all the characters into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located. The available resources of the user in chatting by using the chatting tool are enriched.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for processing an image according to the present application;
FIG. 3A is a schematic diagram of an application scenario of a method for processing an image according to the present application, and FIG. 3B is a schematic diagram of the character drawing of FIG. 3A;
FIG. 4 is a flow diagram of yet another embodiment of a method for processing an image according to the present application;
FIG. 5 is a flow diagram of yet another embodiment of a method for processing an image according to the present application;
FIG. 6 is a schematic block diagram of one embodiment of an apparatus for processing images according to the present application;
FIG. 7 is a block diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the method for processing images or the apparatus for processing images of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a chat tool, a web browser application, a shopping-like application, a search-like application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting information transceiving, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background server that provides support for character drawings displayed on the terminal devices 101, 102, 103. The background server may analyze and perform other processing on the received data such as the target image, and feed back a processing result (e.g., a character drawing) to the terminal device.
It should be noted that the method for processing an image provided in the embodiment of the present application is generally performed by the server 105, and accordingly, the apparatus for processing an image is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for processing an image according to the present application is shown. The method for processing the image comprises the following steps:
in step 201, the contour of the target image is extracted.
In the present embodiment, an electronic device (e.g., a server shown in fig. 1) on which the method for processing an image is operated may receive a target image from a terminal with which a user conducts an online chat through a wired connection manner or a wireless connection manner, and then extract an outline of the received target image. The target image is an image which is manually designated or selected by the machine equipment according to a set of logic, for example, the target image can be an image received from the terminal equipment. In particular, the specific manner in which the image's outline is extracted is well known to those skilled in the art (e.g., findContour and drawContour in OpenCV, which is a cross-platform computer vision library distributed based on BSD license, running on Linux, Windows, Android, and Mac OS operating systems).
It should be noted that the electronic device in this embodiment may adopt a server, or may also adopt a terminal device or other electronic devices that can process images to generate a character drawing.
Step 202, dividing the contour of the target image into regions to obtain at least two regions.
In this embodiment, the electronic device divides the contour of the target image into regions to divide at least two regions of the target image. Specifically, the division may be performed in a preset division manner. For example, the image is equally divided to obtain regions of equal size. The target image may be divided into regions having different sizes. Further, the number or size of the resulting regions may be defined at the time of division. The shape of the region may be square or rectangular, etc.
For the local contour presented in each region, the character matching the local contour is searched, step 203.
In this embodiment, for the local contour presented in each region, the electronic device searches for a character matching the local contour. The local contour is obtained by dividing the contour into regions and is a part of the contour of the image. The characters may be one or more of various characters such as numbers, symbols, letters, words, and the like. The character matching the local contour may mean that the similarity between the character and the local contour is high. For example, a relatively high degree of similarity may refer to a degree of similarity that is greater than a similarity threshold. The similarity threshold may be a definable numerical value preset for similarity. If the character with higher similarity with the local contour cannot be searched, the similarity threshold value searched at this time can be reduced. If the search result still cannot be obtained, the default character can be used as the search result.
And 204, arranging all the characters into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
In this embodiment, the electronic device arranges the respective characters as a character drawing corresponding to the outline of the target image. Specifically, the characters may be arranged according to a positional relationship between the regions where the matched local contours are located, so as to implement a correspondence relationship between the character drawings and the contours of the target image. The character picture is a pattern formed by arranging and combining a plurality of characters in a certain order.
With continued reference to fig. 3A, fig. 3 is a schematic diagram of an application scenario of the method for processing an image according to the present embodiment. In the application scenario of fig. 3, the electronic device 301 extracts an outline 304 of an image 303, where the image 303 is an image uploaded to the terminal device 302 by the user and transmitted to the electronic device 301 by the terminal device 302. Then, the electronic device 301 divides the outline 304 of the image 303 into at least two regions 305. For the local contour presented in each region, the electronic device 301 looks for a character 306 that matches the local contour. The electronic device 301 arranges the characters 306 into a character drawing 307 of the outline of the target image according to the positional relationship between the regions where the matched local outlines are located. Fig. 3B shows the above-described character drawing 307.
The method provided by the embodiment of the application enriches available resources when the user uses the chatting tool to chat.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for processing an image is shown. The flow 400 of the method for processing an image comprises the steps of:
step 401, performing contour detection on the target image to generate a contour of the target image.
In this embodiment, the contour includes a peripheral contour and an internal contour. The method in the embodiment is used for a server, and the server is in communication connection with the terminal equipment. And the server carries out contour detection on the target image to generate a peripheral contour and an internal contour of the target image. Here, the outer contour is an outermost periphery of the contour to define a boundary of the contour. The inner contour is a portion of the contour other than the contour periphery, and is located inside the contour.
Step 402, dividing the contour of the target image into at least two regions.
In this embodiment, the server performs area division on the contour of the target image to divide at least two areas of the target image. Specifically, the division may be performed in a preset division manner. For example, the image is equally divided to obtain regions of equal size. The target image may be divided into regions having different sizes. Further, the number of resulting regions may be defined in the division. The shape of the region may be square or rectangular, etc.
In step 403, for the local contour presented in each region, a character matching the shape of the local contour is searched in a preset character set.
In the present embodiment, after the division of the contour, a local contour is present in each of the areas obtained by the division. For the local contour presented in each area, the server searches a character matched with the shape of the local contour in a preset character set. Here, shape matching means that the character is similar to the shape of the local outline. The preset character set is a preset character set, and the character set may include a plurality of kinds of characters.
And step 404, arranging each character into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
In the present embodiment, the server arranges the respective characters into a character drawing corresponding to the outline of the target image. The character picture is a pattern formed by arranging and combining a plurality of characters in a certain order. Specifically, the characters may be arranged according to a positional relationship between the regions where the matched local contours are located, so as to implement a correspondence relationship between the character drawings and the contours of the target image.
Step 405, sending the character drawing to the terminal equipment.
In this embodiment, the server sends the obtained character drawing to the terminal device. The terminal equipment responds to the received preset operation of the user on the target sub-area in the expression graph selection area before the server extracts the outline of the target image, and sends the target image uploaded by the user. A user may use a chat tool to conduct an online conversation with a chat object. A trigger icon for a selection area of an emoticon may be included in the conversation interface. After the user clicks the trigger icon, the terminal device may display an emoticon selection area. And the expression map selection area comprises a target sub-area. If the terminal device receives a preset operation of the user in the target sub-region, for example, a click operation performed by using a mouse, an image uploading interface can be displayed for the user to upload an image. The target sub-area is a sub-area which is selected from the region selected from the expression graph, manually designated or selected by machine equipment according to a set of logic. An emoticon is a pattern that can exhibit a certain expression. The image uploading interface is an interface which can be used for a user to upload images. After the target image uploaded by the user is acquired, the terminal device can send the target image to a server for processing.
In the embodiment, the character matched with the shape of the local contour is searched to obtain the character more matched with the local contour, and then the character picture with higher degree of correspondence to the contour of the target image is obtained.
With further reference to FIG. 5, a flow 500 of yet another embodiment of a method for processing an image is shown. The flow 500 of the method for processing an image comprises the steps of:
step 501, performing contour detection on the target image to generate a contour of the target image.
In this embodiment, the contour includes a peripheral contour and an internal contour. The method in the embodiment is used for a server, and the server is in communication connection with the terminal equipment. And the server carries out contour detection on the target image to generate a peripheral contour and an internal contour of the target image. Here, the outer contour is an outermost periphery of the contour to define a boundary of the contour. The inner contour is the portion of the contour other than the contour periphery, which is located inside the contour.
Step 502, dividing the contour of the target image into regions to obtain at least two regions.
In this embodiment, the server performs area division on the contour of the target image to divide at least two areas of the target image. Specifically, the division may be performed in a preset division manner. For example, the image is equally divided to obtain regions of equal size. The target image may be divided into regions having different sizes. Further, the number of resulting regions may be defined in the division. The shape of the region may be square or rectangular, etc.
Step 503, comparing the local contour presented in each region with more than one character in a preset character set to determine the shape similarity between the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as the character that matches the local outline.
In this embodiment, for the local contour presented in each region, the server may compare the local contour with one or more characters in a preset character set. One or more of these are equal to or greater than one. The comparison process is a process of determining the similarity of the shape of the local contour and each character in the above-mentioned one or more characters. Then the server responds if it is determined that the local outline has a similarity in shape to at least one of the one or more characters that is greater than a similarity threshold: and determining one character in the at least one character as the character matched with the local contour. The one character determined here may be a character having the highest similarity to the local contour among the one or more characters of the preset character set. Or the character which is found first in the comparison process and has similarity with the local contour larger than the similarity threshold value. And the server stops comparison after finding the character, and takes the character found firstly as a matched character. The shape similarity is a degree of similarity of shapes and may be expressed in the form of a numerical value.
And step 504, arranging all the characters into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
In the present embodiment, the server arranges the respective characters into a character drawing corresponding to the outline of the target image. The character picture is a pattern formed by arranging and combining a plurality of characters in a certain order. Specifically, the characters may be arranged according to a positional relationship between the regions where the matched local contours are located, so as to implement a correspondence relationship between the character drawings and the contours of the target image.
And step 505, sending the character drawing to the terminal equipment.
In this embodiment, the server sends the obtained character drawing to the terminal device. The terminal equipment responds to the received preset operation of a user on a target sub-area in an expression graph selection area before the server extracts the outline of the target image, sends the target image uploaded by the user, specifically can display an image uploading interface, and sends the target image uploaded by the user to the server after receiving the target image uploaded by the user. A user may use a chat tool to conduct an online conversation with a chat object. A trigger icon for a selection area of an emoticon may be included in the conversation interface. After the user clicks the trigger icon, the terminal device may display an emoticon selection area. And the expression map selection area comprises a target sub-area. If the terminal device receives a preset operation of the user in the target sub-region, for example, a click operation performed by using a mouse, an image uploading interface can be displayed for the user to upload an image. The target sub-area is a sub-area which is selected from the region selected from the expression graph, manually designated or selected by machine equipment according to a set of logic. An emoticon is a pattern that can exhibit a certain expression. The image uploading interface is an interface which can be used for a user to upload images.
In the embodiment, the character with higher shape similarity with the local contour is searched to obtain the character which is more matched with the local contour, and further obtain the character picture with higher degree of correspondence with the contour of the target image.
With further reference to fig. 6 as an implementation of the methods shown in the above figures, the present application provides an embodiment of an apparatus for processing an image, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable in various electronic devices.
As shown in fig. 6, the apparatus 600 for processing an image of the present embodiment includes: an extraction unit 601, a division unit 602, a lookup unit 603, and an arrangement unit 604. The extracting unit 601 is configured to extract the contour of the target image; a dividing unit 602 configured to divide a region of the contour of the target image into at least two regions; a search unit 603 configured to search, for a local contour presented in each region, for a character matching the local contour; the arranging unit 604 is configured to arrange the characters into a character drawing of the outline of the target image according to the position relationship between the areas where the matched local outlines are located.
In the present embodiment, the extraction unit 601 may receive the target image from the terminal with which the user performs the online chat by a wired connection manner or a wireless connection manner, and then extract the outline of the received target image. The target image is an image which is manually designated or selected by the machine equipment according to a set of logic, for example, the target image can be an image received from the terminal equipment. In particular, the specific manner in which the image's outline is extracted is well known to those skilled in the art (e.g., findContour and drawContour in OpenCV, which is a cross-platform computer vision library distributed based on BSD license, running on Linux, Windows, Android, and Mac OS operating systems).
In the present embodiment, the dividing unit 602 performs area division on the contour of the target image to divide at least two areas of the target image. Specifically, the division may be performed in a preset division manner. For example, the image is equally divided to obtain regions of equal size. The target image may be divided into regions having different sizes. Further, the number of resulting regions may be defined in the division. The shape of the region may be square or rectangular, etc.
In the present embodiment, for the local contour presented in each region, the search unit 603 searches for a character matching the local contour. The local contour is obtained by dividing the contour into regions and is a part of the contour of the image. The characters may be various characters such as numbers, symbols, letters, words, and the like. The character matching the local contour may mean that the similarity between the character and the local contour is high. For example, a relatively high degree of similarity may refer to a degree of similarity that is greater than a similarity threshold. If the character with higher similarity with the local contour cannot be searched, the similarity threshold value searched at this time can be reduced. If the search result still cannot be obtained, the default character can be used as the search result.
In the present embodiment, the arrangement unit 604 arranges the respective characters into character drawings corresponding to the outline of the target image. The character picture is a pattern formed by arranging and combining a plurality of characters in a certain order. Specifically, the characters may be arranged according to a positional relationship between the regions where the matched local contours are located, so as to implement a correspondence relationship between the character drawings and the contours of the target image.
In some optional implementations of this embodiment, the lookup unit is further configured to: for the local contour presented in each region, a character matching the shape of the local contour is found in a preset character set.
In some alternative implementations of this embodiment, the contour includes a peripheral contour and an internal contour; and the extraction unit is further configured to: and carrying out contour detection on the target image to generate a peripheral contour and an internal contour of the target image.
In some optional implementations of this embodiment, the lookup unit is further configured to: for the local contour presented in each region, comparing the local contour with more than one character in a preset character set to determine the shape similarity of the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as the character that matches the local outline.
In some optional implementations of this embodiment, the apparatus further includes: and the sending unit is configured to send the character picture to the terminal equipment, wherein the terminal equipment sends the target image uploaded by the user in response to receiving the preset operation of the user on the target sub-area in the expression map selection area.
Fig. 7 shows a schematic structural diagram of a computer device suitable for implementing an electronic apparatus according to an embodiment of the present application. As shown in fig. 7, the computer apparatus 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the apparatus 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program, when executed by a Central Processing Unit (CPU)701, performs the above-described functions defined in the method of the present application. It should be noted that the computer readable medium of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor device, apparatus, or a combination of any of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution apparatus, device, or apparatus. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution apparatus, device, or apparatus. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an extraction unit, a division unit, a search unit, and an arrangement unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, the extraction unit may also be described as a "unit that extracts the outline of the target image".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: extracting the outline of the target image; dividing the outline of the target image into regions to obtain at least two regions; for the local contour presented in each area, searching for a character matched with the local contour; and arranging the characters into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (12)

1. A method for processing an image, comprising:
extracting the outline of the target image;
dividing the contour of the target image into regions to obtain at least two regions, wherein the regions are local contours;
for the local contour presented in each area, searching for a character matched with the local contour based on the similarity between the character and the local contour;
arranging each character into a character picture of the outline of the target image according to the position relation between the areas where the matched local outlines are located;
wherein the dividing the contour of the target image into regions to obtain at least two regions comprises:
the contour of the target image is divided into regions of unequal size to obtain regions of different sizes.
2. The method for processing an image according to claim 1, wherein the finding, for the local contour presented in each region, a character matching the local contour comprises:
for the local contour presented in each region, a character matching the shape of the local contour is found in a preset character set.
3. The method for processing an image according to claim 1, wherein said extracting the contour of the target image comprises:
and carrying out contour detection on the target image to generate a contour of the target image, wherein the contour comprises a peripheral contour and an internal contour.
4. The method for processing an image according to claim 1, wherein the finding, for the local contour presented in each region, a character matching the local contour comprises:
for the local contour presented in each region, comparing the local contour with more than one character in a preset character set to determine the shape similarity of the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as a character that matches the local outline.
5. A method for processing an image as recited in claim 1, wherein the method further comprises:
and sending the character picture to terminal equipment, wherein the terminal equipment sends the target image uploaded by the user in response to the fact that the preset operation of the user on the target sub-area in the expression picture selection area is received.
6. An apparatus for processing an image, comprising:
an extraction unit configured to extract a contour of a target image;
the dividing unit is configured to divide a region of the contour of the target image to obtain at least two regions, wherein the region is a local contour;
the searching unit is configured to search a character matched with the local contour based on the similarity between the character and the local contour for the local contour presented in each area;
the arrangement unit is configured to arrange each character into a character drawing of the outline of the target image according to the position relation between the areas where the matched local outlines are located;
wherein the dividing unit is further configured to:
the contour of the target image is divided into regions of unequal size to obtain regions of different sizes.
7. The apparatus for processing an image according to claim 6, wherein the lookup unit is further configured to:
for the local contour presented in each region, a character matching the shape of the local contour is found in a preset character set.
8. An apparatus for processing an image according to claim 6, wherein the extraction unit is further configured to:
and carrying out contour detection on the target image to generate a contour of the target image, wherein the contour comprises a peripheral contour and an internal contour.
9. The apparatus for processing an image according to claim 6, wherein the lookup unit is further configured to:
for the local contour presented in each region, comparing the local contour with more than one character in a preset character set to determine the shape similarity of the local contour and the more than one character; in response to determining that the local outline has a shape similarity to at least one of the more than one character that is greater than a similarity threshold, determining one of the at least one character as a character that matches the local outline.
10. The apparatus for processing an image according to claim 6, wherein said apparatus further comprises:
and the sending unit is configured to send the character picture to the terminal equipment, wherein the terminal equipment sends the target image uploaded by the user in response to receiving the preset operation of the user on the target sub-area in the expression graph selection area.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201711163973.7A 2017-11-21 2017-11-21 Method and apparatus for processing image Active CN107818323B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711163973.7A CN107818323B (en) 2017-11-21 2017-11-21 Method and apparatus for processing image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711163973.7A CN107818323B (en) 2017-11-21 2017-11-21 Method and apparatus for processing image

Publications (2)

Publication Number Publication Date
CN107818323A CN107818323A (en) 2018-03-20
CN107818323B true CN107818323B (en) 2021-12-07

Family

ID=61609689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711163973.7A Active CN107818323B (en) 2017-11-21 2017-11-21 Method and apparatus for processing image

Country Status (1)

Country Link
CN (1) CN107818323B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109445963A (en) * 2018-11-05 2019-03-08 北京达佳互联信息技术有限公司 Content share method, device, equipment and computer readable storage medium
CN109816743A (en) 2018-12-19 2019-05-28 华为技术有限公司 Generate the method and terminal device of identification pattern
CN112801098B (en) * 2019-11-14 2023-01-10 临沂市拓普网络股份有限公司 Contour technology-based mathematical symbol identification method
CN111104500A (en) * 2019-12-21 2020-05-05 江西省天轴通讯有限公司 Cable matching method, system, readable storage medium and computer equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050691A (en) * 2013-03-11 2014-09-17 百度国际科技(深圳)有限公司 Device and method for generating corresponding character picture based on image in terminal
CN105513023A (en) * 2015-12-03 2016-04-20 中国航空工业集团公司洛阳电光设备研究所 Image full-screen anti-aliasing method and device for head-up display characters
CN106651852A (en) * 2016-12-28 2017-05-10 天津普达软件技术有限公司 Detection method for key stroke missing of spray printed character

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050691A (en) * 2013-03-11 2014-09-17 百度国际科技(深圳)有限公司 Device and method for generating corresponding character picture based on image in terminal
CN105513023A (en) * 2015-12-03 2016-04-20 中国航空工业集团公司洛阳电光设备研究所 Image full-screen anti-aliasing method and device for head-up display characters
CN106651852A (en) * 2016-12-28 2017-05-10 天津普达软件技术有限公司 Detection method for key stroke missing of spray printed character

Also Published As

Publication number Publication date
CN107818323A (en) 2018-03-20

Similar Documents

Publication Publication Date Title
CN107818323B (en) Method and apparatus for processing image
US20200013386A1 (en) Method and apparatus for outputting voice
CN109711508B (en) Image processing method and device
US11941529B2 (en) Method and apparatus for processing mouth image
CN109255337B (en) Face key point detection method and device
CN109472264B (en) Method and apparatus for generating an object detection model
CN111310866B (en) Data labeling method, device, system and terminal equipment
CN109377508B (en) Image processing method and device
CN109446442B (en) Method and apparatus for processing information
US11244153B2 (en) Method and apparatus for processing information
CN110288625B (en) Method and apparatus for processing image
CN111783777B (en) Image processing method, apparatus, electronic device, and computer readable medium
US11588822B2 (en) Right control method and apparatus for terminal device
CN109426878B (en) Method and apparatus for outputting information
CN110895699B (en) Method and apparatus for processing feature points of image
CN109523564B (en) Method and apparatus for processing image
CN108664948B (en) Method and apparatus for generating information
CN109522429B (en) Method and apparatus for generating information
US20230005171A1 (en) Visual positioning method, related apparatus and computer program product
CN111784709B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN114862720A (en) Canvas restoration method and device, electronic equipment and computer readable medium
CN111414566A (en) Method and device for pushing information
CN111311604A (en) Method and apparatus for segmenting an image
CN109634827A (en) Method and apparatus for generating information
CN109344318B (en) Method and apparatus for processing information

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