CN106204588B - Image processing method and device - Google Patents

Image processing method and device Download PDF

Info

Publication number
CN106204588B
CN106204588B CN201610539785.9A CN201610539785A CN106204588B CN 106204588 B CN106204588 B CN 106204588B CN 201610539785 A CN201610539785 A CN 201610539785A CN 106204588 B CN106204588 B CN 106204588B
Authority
CN
China
Prior art keywords
icon
boundary
pixel
image
pixel points
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
CN201610539785.9A
Other languages
Chinese (zh)
Other versions
CN106204588A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610539785.9A priority Critical patent/CN106204588B/en
Publication of CN106204588A publication Critical patent/CN106204588A/en
Application granted granted Critical
Publication of CN106204588B publication Critical patent/CN106204588B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention discloses an image processing method and device; when an image processing request is received, acquiring pixel points of an image according to the image processing request to obtain a pixel point set, searching original icon boundary pixel points in the pixel point set, expanding an original icon boundary of an icon according to a preset pixel interval and the original icon boundary pixel points, updating the pixel point set according to an expansion result, searching icon boundary pixel points in the updated pixel point set, and cutting out a corresponding icon from the image according to position information of the icon boundary pixel points in the image; the scheme can improve the efficiency of cutting the graph.

Description

Image processing method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to an image processing method and apparatus.
Background
The cutting refers to cutting the design drawing into pictures which are convenient to be made into pages. Generally speaking, a cutting tool is used to cut out an icon in a design drawing to obtain a cut icon picture.
In the prior art, a fixed-size Icon cutting mode is generally adopted, namely icons are placed in a grid area in advance, and then the icons are cut; for example, referring to fig. 1a, when designing an Icon, icons are placed in a certain order to obtain a design drawing to be cut, then positions of the design drawing in a network are continuously adjusted during cutting, so that the icons in the design drawing are in corresponding grid regions, and finally, the cutting processing is performed based on the grid regions to obtain one Icon, wherein the size of each Icon is consistent (for example, the pixel points of the icons are 50 × 50).
In the process of research and practice of the prior art, the inventor of the invention finds that the prior graph cutting mode is relatively complex in graph cutting operation, and therefore, the graph cutting efficiency is relatively low.
Disclosure of Invention
The embodiment of the invention provides an image processing method and device, which can improve the image cutting efficiency.
The embodiment of the invention provides an image processing method, which comprises the following steps:
receiving an image processing request, the image processing request indicating an image that needs to be processed, the image including a plurality of icons;
acquiring pixel points of the image according to the image processing request to obtain a pixel point set;
searching original icon boundary pixel points in the pixel point set, and expanding the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel points;
updating the pixel point set according to the expansion result;
searching icon boundary pixel points in the updated pixel point set, and cutting out corresponding icons from the images according to the position information of the icon boundary pixel points in the images.
Correspondingly, an embodiment of the present invention further provides an image processing apparatus, including:
a receiving unit configured to receive an image processing request indicating an image that needs to be processed, the image including a plurality of icons;
the acquisition unit is used for acquiring pixel points of the image according to the image processing request to obtain a pixel point set;
the expansion unit is used for searching pixel points of the boundary of the original icon in the pixel point set and expanding the boundary of the original icon of the icon according to a preset pixel interval and the pixel points of the boundary of the original icon;
the updating unit is used for updating the pixel point set according to the expansion;
and the cutting unit is used for searching the icon boundary pixel points in the updated pixel point set and cutting out the corresponding icons from the images according to the position information of the icon boundary pixel points in the images.
When an image processing request is received, acquiring pixel points of an image according to the image processing request to obtain a pixel point set, searching original icon boundary pixel points in the pixel point set, expanding an original icon boundary of an icon according to a preset pixel interval and the original icon boundary pixel points, updating the pixel point set according to an expansion result, searching icon boundary pixel points in the updated pixel point set, and cutting out a corresponding icon from the image according to position information of the icon boundary pixel points in the image; according to the scheme, the image can be cut based on the position information of the icon boundary pixels in the image, namely, the image can be cut according to the actual size of the icon, and the user does not need to perform operations such as image position adjustment and the like during image cutting, so that the image cutting operation is simplified and the image cutting efficiency can be improved compared with the prior art.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1a is a schematic diagram of a prior art cutting pattern;
FIG. 1b is a flowchart of an image processing method provided by an embodiment of the invention;
FIG. 1c is a schematic diagram of an icon provided by an embodiment of the present invention;
FIG. 1d is a diagram illustrating an expansion of an icon boundary according to an embodiment of the present invention;
FIG. 1e is a schematic cut-away view of an embodiment of the present invention;
FIG. 2a is another flowchart of an image processing method according to an embodiment of the present invention;
FIG. 2b is a schematic diagram of a cutting interface provided by an embodiment of the present invention;
FIG. 2c is a schematic diagram of a cut completion provided by an embodiment of the present invention;
FIG. 2d is a schematic diagram illustrating resizing of a picture according to an embodiment of the present invention;
FIG. 3a is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention;
fig. 3b is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides an image processing method and device. The following are detailed below. The first embodiment,
The embodiment will be described from the perspective of an image processing apparatus, which may be specifically integrated in a terminal or the like, and the terminal may be specifically a mobile phone, a tablet computer, or a PC (personal computer) or the like.
An image processing method comprising: receiving an image processing request, the image processing request indicating an image that needs to be processed, the image including a plurality of icons; acquiring pixel points of the image according to the image processing request to obtain a pixel point set; searching an original icon boundary pixel point in the pixel point set, and expanding the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel point so as to update the pixel point set; searching icon boundary pixel points in the updated pixel point set, and cutting out corresponding icons from the images according to the position information of the icon boundary pixel points in the images.
As shown in fig. 1b, a specific flow of the image processing method may be as follows:
101. an image processing request is received, the image processing request indicating an image that needs to be processed, the image including a plurality of icons.
The image in this embodiment may be a static image, i.e., a picture, and the icon may have various formats, for example, a PNG (portable network graphics) format, a BMP (bitmap) format, a JPEG (joint photographic experts group) format, and the like.
The Icon (Icon) may be any form of computer graphics, such as computer graphics with explicit meaning, for example, the Icon may be a desktop Icon (i.e. software identifier), an interface Icon (i.e. function identifier), or other graphic symbols with meaning, etc.
The image processing request may be triggered through a trigger interface such as a preset trigger key or an input box in the trigger terminal, for example, when a user clicks or slides an icon, the image processing request is triggered to be generated, at this time, the image processing apparatus may receive the image processing request, for example, the image processing request is received through a preset instruction receiving interface, and the like.
102. And acquiring pixel points of the image according to the image processing request to obtain a pixel point set.
The pixel point set comprises a plurality of pixel points, and the set can have various forms, such as an array form; specifically, pixel points of an image can be obtained according to an image processing request, so as to obtain a one-dimensional pixel array, wherein one array element in the one-dimensional pixel array can represent one pixel point; at this time, the one-dimensional pixel array is a pixel point set;
in order to facilitate image cutting and accelerate image cutting speed, the method can also convert the one-dimensional pixel array into a two-dimensional pixel array, and at the moment, the two-dimensional pixel array is a pixel point set; for example, a one-dimensional pixel array may be converted to a corresponding two-dimensional pixel array based on the size (width and height) of the image.
Optionally, in order to improve the graph cutting speed and the graph cutting accuracy, the method of this embodiment may cut the graph based on the effective pixel points, and at this time, the pixel point set may be an effective pixel point set, where the effective pixel point set includes a plurality of effective pixel points; that is, the step of obtaining the pixel point of the image according to the image processing request to obtain the pixel point set may include:
acquiring pixel points of the image according to the image processing request to obtain an original pixel point set;
determining effective pixel points and ineffective pixel points in the original pixel point set;
and determining a pixel point set according to the effective pixel point.
The effective pixel point can be a pixel point with a gray scale meeting a preset condition, for example, a pixel point with a gray scale level reaching the preset level or a gray scale value greater than a preset threshold can be determined as an effective pixel point, the ineffective pixel point is a pixel point with a gray scale not meeting the preset condition, for example, a pixel point with a gray scale value less than the preset threshold is determined as an ineffective pixel point, a transparent pixel point (with a gray scale value of 0) can be determined as an ineffective pixel point in actual application, and an opaque pixel point (with a gray scale value of 0) is determined as an effective pixel point; the preset conditions can be set according to actual requirements; that is, the step of "determining valid pixel points and invalid pixel points in the original pixel point set" may include:
and determining effective pixel points and ineffective pixel points in the original pixel point set according to the gray scale corresponding to the pixel points in the original pixel point set.
In practical application, in order to facilitate the image cutting and improve the image cutting speed, a first pixel identifier may be set for an effective pixel and a second identifier may be set for an ineffective pixel to distinguish the pixels, for example, the effective pixel is marked with a bit 1, and the ineffective pixel is marked with a bit 0.
Optionally, in order to meet the actual demand for cutting a graph, the flexibility of cutting a graph is improved, for example, a picture including at least two icons is cut from an image, a protection region may be allowed to be set between the two icons in this embodiment, and the protection region is not cut when the graph is cut, that is, after the step "determining an effective pixel point and an ineffective pixel point in the original pixel point set", the step "determining a pixel point set according to the effective pixel point" in this embodiment may further include:
determining whether the image is provided with a protection area;
and if so, determining the invalid pixel points in the protection area as valid pixel points.
In this embodiment, under the condition that the identification is set for the valid pixel and the invalid pixel, the invalid pixel can be determined as the valid pixel by changing the identification of the invalid pixel, that is, the step "determining the invalid pixel located in the protection area as the valid pixel" can include: and changing the second pixel identification of the invalid pixel point in the protection area into the first pixel identification so as to determine the invalid pixel point as an effective pixel point. For example, the flag 0 of the invalid pixel point in the protection area is changed to 1.
103. And searching the original icon boundary pixel points in the pixel point set, and expanding the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel points.
The original icon boundary pixel point may be a pixel point corresponding to the original boundary of the icon.
Optionally, in order to distinguish the pixel points and facilitate the image cutting, in this embodiment, after the original icon boundary pixel points of the icon are searched in the pixel point set, an identifier may be set for the original icon boundary pixel points, specifically, a third pixel identifier is set for the original icon boundary pixel points, for example, the original icon boundary pixel points are marked as 2.
Considering that an icon may include multiple sub-icons that are independent and separate from each other, and thus may have multiple boundaries, if the icon is cut based on only the original icon boundary pixel points, the icon may be cut into multiple icons, and the accuracy of the cut is relatively poor, for example, referring to fig. 1c, the "footprint" icon has four original icon boundaries, and if the icon is cut based on the original icon boundaries directly, the "footprint" icon may be cut into four icons, and it is obvious that the cut is wrong; in order to overcome the foregoing problems and improve the accuracy of the graph cutting, the present embodiment may expand the boundary of the original icon to fill the space between the sub-icons, and then cut the graph based on the expanded boundary; that is, after searching for the original icon boundary pixel point, the present embodiment may also expand the original icon boundary of the icon according to the preset pixel interval and the original icon boundary pixel point.
The preset pixel interval is a boundary extension distance represented by a pixel, such as 10 pixels, 5 pixels, and the like. The preset pixel interval can be set according to actual requirements. Optionally, there may be a plurality of manners for obtaining the preset pixel interval, for example, when the image processing request carries the preset pixel interval, the preset pixel interval may be obtained from the image processing request, or for example, the preset pixel interval may be obtained from a storage unit based on the image processing request.
Specifically, the step of "expanding the original icon boundary of the icon according to the preset pixel interval and the original icon boundary pixel point" may include:
drawing a corresponding original icon boundary according to the original icon boundary pixel points;
and extending the original icon boundary outwards according to the preset pixel interval, wherein the distance between the extended icon boundary and the original icon boundary is equal to the preset pixel interval.
The distance between the boundary of the extended icon and the boundary of the original icon refers to a line distance between the boundary line of the extended icon and the boundary line of the original icon, and the line distance may be defined as a shortest distance between two non-intersecting lines.
For example, referring to fig. 1d, the original icon boundary of the "footprint" icon may be expanded based on 10 pixel points, where a distance d between the expanded icon boundary line and the original icon boundary line is 10 pixel points; as shown, after the original icon boundaries of the "footprint" icon are expanded, the spaces between sub-icons in the "footprint" icon are filled.
Optionally, the method for depicting the boundary of the original icon in this embodiment may be various, for example, the original icon boundary pixel points belonging to the same original icon boundary may be obtained to obtain the original icon boundary pixel point set, and then the corresponding icon boundary is depicted based on the original icon boundary pixel point set. The original icon boundary pixel points belonging to the same icon boundary can be obtained based on the interval or distance between the original icon boundary pixel points.
104. And updating the pixel point set according to the expanded result.
Specifically, after the boundary of the original icon is expanded, the pixel point set may be updated based on the result of the expansion of the boundary, for example, a pixel point on the boundary of the expanded original icon may be determined in the pixel point set according to the expanded result, and then, the attribute information of the pixel point may be changed to update the pixel point set, such as changing the pixel point identifier, the gray scale value, and the like. 105. Searching icon boundary pixel points in the updated pixel point set, and cutting out corresponding icons from the images according to the position information of the icon boundary pixel points in the images.
For example, after the original icon boundary is expanded, icon boundary pixel points can be searched in the updated pixel point set again, fourth pixel identifiers are set for the icon boundary pixel points, so that the icon picture containing the icon is cut conveniently, for example, the icon boundary pixel points are marked as 3, and then the icon picture containing the icon is cut according to the position information of the icon pixel points in the image.
The position information of the icon boundary pixel point in the image may include: and (3) cutting out the corresponding icon from the image according to the two-dimensional coordinate value of the icon boundary pixel point.
Specifically, the step of "cutting out a corresponding icon from the image according to the position information of the icon boundary pixel point in the image" may include:
determining icon boundary pixel points belonging to the same icon boundary to obtain a boundary pixel point set corresponding to the icon boundary;
acquiring position information of the boundary pixel points of the image in the boundary image point set in the image;
and cutting the icon from the image according to the position information.
In the embodiment of the method, after the icon boundary pixel points are found, the icon boundary pixel points belonging to the same or the same icon boundary are determined to obtain the boundary pixel point set corresponding to the icon boundary, and specifically, the icon boundary pixel points belonging to the same or the same icon boundary are determined according to the interval between the icon boundary pixel points; for example, icon boundary pixel points belonging to the same or same icon boundary may be determined based on the interval or pitch between adjacent icon boundary pixel points; because the icon boundary pixel points belonging to the same icon boundary are all continuous, and the interval between the adjacent icon boundary pixel points is smaller than a preset threshold, a certain icon boundary pixel point can be used as a starting point, then the adjacent icon boundary pixel points with the interval smaller than the preset threshold are searched, then the icon boundary pixel points with the interval smaller than the preset threshold are searched, … … is analogized, and the icon boundary pixel points belonging to the same icon boundary can be searched.
In an actual situation, generally, an interval between two adjacent icon boundary pixel points on the same icon boundary is zero, that is, the two adjacent icon boundary pixel points are connected, so that in this embodiment, one icon boundary pixel point, which is marked as a, can be found first, then the adjacent icon boundary pixel point connected to the icon boundary pixel point is found, which is marked as a, then other icon boundary pixel points of the adjacent icon boundary pixel points are obtained, which is also marked as a, … … and so on, and all icon boundary pixel points corresponding to a certain icon boundary a can be obtained, that is, a boundary pixel point set corresponding to the icon boundary a is obtained.
For example, when all the icon boundary pixels are marked as 3, the icon boundary pixels can be traversed, when one icon boundary pixel (such as the icon boundary pixel which is encountered for the first time) is encountered, all the icon boundary pixels 3 which belong to the icon boundary corresponding to the icon boundary pixel 3 are marked as 3+1, namely 4, so as to obtain a boundary pixel set corresponding to the icon boundary 4, specifically, all the icon boundary pixels of the boundary can be marked as 4 by searching the icon boundary pixel which is connected with the icon boundary pixel, so as to obtain a boundary pixel set corresponding to the icon boundary 4, wherein the boundary pixel set comprises the icon boundary pixels marked as 4; after marking is completed, when icon boundary pixel points of a new icon boundary are encountered, all icon boundary pixel points of the new icon boundary are marked as 3+1+1, namely 5, so as to obtain a boundary pixel point set corresponding to the new icon boundary 5, and by analogy, boundary pixel point sets corresponding to icon boundaries 6, 7, 8 … … and the like can be obtained.
The icon can be cut according to the position information of the icon boundary pixel points in various ways, for example, an icon cutting area can be determined on an image according to the position information of the icon boundary pixel points, and then the corresponding icon is cut based on the icon cutting area.
In order to improve the accuracy of the graph cutting and save system resources, in this embodiment, the icon may be cut based on the actual position information of the icon boundary pixel point, that is, the icon is cut according to the actual size of the icon, and the step "cutting the icon from the image according to the position information" may include:
acquiring position offset information corresponding to the preset pixel interval;
acquiring actual position information of the image boundary pixel points in the image in the boundary image point set according to the position offset information and the position information;
and cutting the icon from the image according to the actual position information.
In this embodiment, an icon may be directly cut from an image according to actual location information of an icon boundary pixel point in a boundary image point set in the image, for example, an icon cutting area or an outline may be determined according to the actual location information of the icon boundary pixel point in the boundary image point set in the image, then, cutting may be performed based on the icon cutting area or the outline, or size information (width, height, etc.) corresponding to the icon may be obtained according to the icon boundary pixel point, then, cutting may be performed based on the actual location information and the size information, that is, "cutting the icon from the image according to the actual location information" may include:
acquiring size information corresponding to the icon according to actual position information of the boundary pixel points of the icon in the boundary pixel point set;
and cutting the icon from the image according to the size information and the actual position information.
For example, an icon cutting region may be determined according to the size information of the icon and the actual position information of the icon boundary pixel point, and then a corresponding icon is cut from the image according to the icon cutting region. In practical applications, the icon may be cut out from the image by using canvas of hypertext Markup Language (HTML), such as HTML5, in combination with the size information and the actual position information.
For example, referring to fig. 1e, taking an image including four icons as an example, by applying the image processing method of the present embodiment, a picture is cut according to the actual size of the icon, and finally four icon pictures are cut, where each icon picture includes one icon, and the size of the icon picture is adapted to the size of the icon included in the icon picture, that is, the width and height of the icon picture are equal to the width and height of the icon included in the icon picture.
As can be seen from the above, when an image processing request is received, the embodiment of the present invention may obtain a pixel point of the image according to the image processing request, to obtain a pixel point set, then search for an original icon boundary pixel point in the pixel point set, expand an original icon boundary of an icon according to a preset pixel interval and the original icon boundary pixel point, update the pixel point set according to the expanded result, search for an icon boundary pixel point in the updated pixel point set, and cut out a corresponding icon from the image according to position information of the icon boundary pixel point in the image; according to the scheme, the image can be cut based on the position information of the boundary pixels of the icon in the image, namely, the image can be cut according to the actual size of the icon, and the user does not need to adjust the position of the image and other operations during image cutting, so that the image cutting operation is simplified and the image cutting efficiency can be improved compared with the prior art; in addition, because the scheme can cut the graph according to the actual size of the icon, the accuracy of the graph cutting can be improved, and system resources can be saved.
Example II,
The method described in the first embodiment is further illustrated by way of example.
In the present embodiment, the image processing apparatus will be described by taking as an example that the image processing apparatus is integrated in a terminal.
The image processing device can be integrated in the terminal in the form of software, for example, can be integrated in the terminal browser in the form of software, and the like.
As shown in fig. 2a, a specific flow of an image processing method may be as follows:
201. the terminal receives an image processing request indicating an image that needs to be processed, the image including a plurality of icons.
In this embodiment, the image to be processed may be a static image, i.e., a picture, and the icon may have various formats, for example, a PNG (portable network graphics) format, a BMP (bitmap) format, a JPEG (joint photographic experts group) format, and the like.
The Icon (Icon) may be any form of computer graphics, such as computer graphics with explicit meaning, for example, the Icon may be a desktop Icon (i.e. software identifier), an interface Icon (i.e. function identifier), or other graphic symbols with meaning, etc
The image processing request may be triggered by a trigger interface such as a preset trigger key or an input box in the trigger terminal, for example, when a user clicks or strokes an icon, the image processing request is triggered to be generated.
Referring to fig. 2b, taking an example of a picture 20 including a plurality of icons, the picture 20 may be an Icon aggregate graph, and after uploading the Icon 20 to a terminal browser, a user may set a pixel interval in advance by moving a slider 21 on a sliding rail 22, so as to expand a boundary based on the pixel interval in a graph cutting process, as shown in fig. 2b, the pixel interval is set to 20px, that is, 20 pixels; when the user clicks the "map cutting button" 23 in the map cutting interface, the terminal browser is triggered to generate an icon processing request, and at this time, the image processing apparatus in this embodiment may receive the image processing request.
In order to meet the user's requirements for cutting a map and improve the flexibility of cutting the map, for example, a picture including at least two icons is cut from the image, the embodiment may set a protection area, as shown in fig. 2b, a protection area setting button 24 is provided in the map cutting interface, if the user wants to cut an icon image including a "shopping cart" and a "business card", the user may click the button 24, and then the user may set a protection area on the picture 20 (e.g., select the protection area by a frame selection), for example, the area indicated by a dashed box 25 in fig. 2b may be selected as the protection area; in this embodiment, the protection area is not cut off, and when an area between two adjacent icons is selected as the protection area, an icon picture including the two adjacent icons can be cut off.
202. And the terminal acquires the pixel points of the image according to the image processing request to obtain an original pixel point set, and determines effective pixel points and ineffective pixel points in the original pixel point set.
Specifically, for convenience of map cutting, the identifiers may be set for the valid pixel points and the invalid pixel points, for example, the valid pixel points are marked as 1, and the invalid pixel points are marked as 0.
In this embodiment, the valid pixel points and the invalid pixel points may be determined based on gray scales corresponding to the pixel points, for example, the pixel points whose gray scale levels reach a preset level or whose gray scale values are greater than a preset threshold may be determined as the valid pixel points, and the invalid pixel points are determined as the pixel points whose gray scales do not satisfy the preset condition, and so on.
203. The terminal determines whether the icon has a protection area, if so, step 204 is executed, and if not, step 205 is executed.
204. And the terminal determines the invalid pixel points in the protection area as valid pixel points.
For example, the invalid pixel points in the dashed line frame in fig. 2b may be determined as valid pixel points. Under the condition that the pixel point is provided with the identification, the invalid pixel point can be determined to be the valid pixel point through the identification change of the pixel point, for example, the mark 0 of the invalid pixel point in the protection area is changed into 1.
205. And the terminal determines a pixel point set according to the effective pixel points and searches the boundary pixel points of the original icon in the pixel point set.
The original icon boundary pixel point may be a pixel point corresponding to the original boundary of the icon.
Optionally, in order to distinguish pixel points and facilitate graph cutting, in this embodiment, after an original icon boundary pixel point of an icon is found in the pixel point set, an identifier may be set for the original icon boundary pixel point, specifically, a pixel identifier is set for the original icon boundary pixel point, for example, the original icon boundary pixel point is marked as 2.
206. And the terminal expands the original icon boundary of the icon according to the preset pixel interval and the original icon boundary pixel point, and updates the pixel point set according to the expansion result.
Considering that an icon may include a plurality of sub-icons that are independent and separated from each other, and therefore may have a plurality of boundaries, if the icon is cut based on only the pixels on the boundary of the original icon, which may result in cutting the icon into a plurality of icons, the accuracy of the cut icon is relatively poor, and the accuracy of the cut icon is improved, this embodiment may expand the boundary of the original icon to fill the space between the sub-icons, and then cut the icon based on the expanded boundary.
Specifically, the step "the terminal expands the original icon boundary of the icon according to the preset pixel interval and the original icon boundary pixel point" may include:
drawing a corresponding original icon boundary according to the original icon boundary pixel points;
and extending the original icon boundary outwards according to the preset pixel interval, wherein the distance between the extended icon boundary and the original icon boundary is equal to the preset pixel interval.
The distance between the boundary of the extended icon and the boundary of the original icon refers to a line distance between the boundary line of the extended icon and the boundary line of the original icon, and the line distance may be defined as a shortest distance between two non-intersecting lines.
In this embodiment, the preset pixel interval may be a boundary extension distance represented by a pixel point. The preset pixel interval can be set according to actual requirements, such as 10 pixel points, 5 pixel points and the like; for example, referring to fig. 2b, the user can set the pixel interval in advance by moving the slider 21 on the slide rail 22, and the pixel interval is set to 20 pixels in the figure.
207. And the terminal searches the icon boundary pixel points in the updated pixel point set, determines the icon boundary pixel points belonging to the same icon boundary, and obtains a boundary pixel point set corresponding to the icon boundary.
For convenience of cutting the graph, the terminal of this embodiment may also set a pixel identifier for the icon boundary pixel, for example, mark the icon boundary pixel as 3.
Specifically, the method of the embodiment may determine the icon boundary pixel points belonging to the same or the same icon boundary after finding the icon boundary pixel points, to obtain a boundary pixel point set corresponding to the icon boundary, and specifically, may determine the icon boundary pixel points belonging to the same or the same icon boundary according to the interval between the icon boundary pixel points; for example, icon boundary pixel points belonging to the same or the same icon boundary may be determined based on the interval or pitch between adjacent icon boundary pixel points.
In practical application, generally, the interval between two adjacent icon boundary pixel points on the same icon boundary is zero, that is, the two adjacent icon boundary pixel points are connected, so that in this embodiment, one icon boundary pixel point can be found first, and then, all boundary pixel points belonging to the same icon boundary can be obtained by finding the connected boundary pixel points.
For example, when all the icon boundary pixels are marked as 3, the icon boundary pixels can be traversed, when one icon boundary pixel (such as the icon boundary pixel which is encountered for the first time) is encountered, all the icon boundary pixels 3 which belong to the icon boundary corresponding to the icon boundary pixel 3 are marked as 3+1, namely 4, so as to obtain a boundary pixel set corresponding to the icon boundary 4, specifically, all the icon boundary pixels of the boundary can be marked as 4 by searching the icon boundary pixel which is connected with the icon boundary pixel, so as to obtain a boundary pixel set corresponding to the icon boundary 4, wherein the boundary pixel set comprises the icon boundary pixels marked as 4; after marking is completed, when icon boundary pixel points of a new icon boundary are encountered, all icon boundary pixel points of the new icon boundary are marked as 3+1+1, namely 5, so as to obtain a boundary pixel point set corresponding to the new icon boundary 5, and by analogy, boundary pixel point sets corresponding to icon boundaries 6, 7, 8 … … and the like can be obtained.
208. The terminal obtains the position information of the boundary pixel points of the icon in the boundary image point set in the image and the position offset information corresponding to the preset pixel interval, and obtains the actual position information corresponding to the boundary pixel points of the icon according to the position offset information and the position information.
The actual position information corresponding to the icon boundary pixel point refers to the actual position information of the icon boundary pixel point in the icon.
The position information or the actual position information of the icon boundary pixel point in the image may include: two-dimensional coordinate information of the icon boundary pixel points, such as an abscissa (x) value and an ordinate (y) value of the icon boundary pixel points; at this time, the position offset information corresponding to the preset pixel interval may include: the offset of the horizontal and vertical coordinates. The preset positional offset information may be set based on a preset pixel interval.
209. And the terminal cuts the icon from the image according to the actual position information corresponding to the icon boundary pixel point in the boundary pixel point set.
For example, the terminal may cut out an icon picture containing the icon from the image according to the actual position information corresponding to the icon boundary pixel point.
Specifically, the terminal may directly cut the icon from the image according to the actual location information of the icon boundary pixel points in the boundary pixel point set in the image, for example, the icon cutting area or the outline may be determined according to the actual location information of the icon boundary pixel points in the boundary pixel point set in the image, then, the cutting may be performed based on the icon cutting area or the outline, or the size information (width, height, etc.) corresponding to the icon may be obtained according to the icon boundary pixel points, then, the cutting may be performed based on the actual location information and the size information, that is, the step "the terminal cuts the icon from the image according to the actual location information corresponding to the icon boundary pixel points in the boundary pixel point set" may include: and the terminal acquires the size information corresponding to the icon according to the actual position information corresponding to the icon boundary pixel points in the boundary pixel point set, and then cuts out the icon from the image according to the size information and the actual position information.
For example, an icon cutting area can be determined according to the size information of the icon and the actual position information of the pixel point of the boundary of the icon, and then the corresponding icon is cut from the image according to the icon cutting area, so that the picture can be cut according to the actual size of each picture; for example, referring to fig. 2c, ten icon pictures containing different icons may be cut from the image 20 according to the actual position information and the actual size information of the icon boundary pixel point of each icon, and the size of each icon picture is adapted to the size of the icon contained in the icon picture, that is, the width and the height of the icon picture are equal to the width and the height of the icon contained in the icon picture.
Optionally, in order to facilitate the use of the icon and save resources of a system when the icon is used, the size of the icon picture may be adjusted to be a uniform size, that is, before the plurality of icon pictures including the icon are cut from the image, the method of this embodiment may further include:
and adjusting the sizes of the icon pictures according to the unified picture size.
The preset unified picture size may be set according to actual requirements, for example, referring to fig. 2d, the unified picture size may be set to 200 pixels by 200 pixels, and at this time, the terminal may adjust the sizes of all icon pictures to 200 pixels by 200 pixels. In this embodiment, there may be multiple ways of acquiring the uniform picture size, for example, size information input by a user may be acquired through a picture size acquisition interface, and the presentation form of the interface may be an icon, an input box, or the like.
Optionally, after adjusting the size of the icon picture, the method of this embodiment further includes:
the terminal receives the downloading request and packages the icon pictures according to the downloading request to obtain a packaged file;
and the terminal downloads the packaged file to the local.
As can be seen from the above, when an image processing request is received, the embodiment of the present invention may obtain a pixel point of the image according to the image processing request, to obtain a pixel point set, then search for an original icon boundary pixel point in the pixel point set, expand an original icon boundary of an icon according to a preset pixel interval and the original icon boundary pixel point, update the pixel point set according to the expanded result, search for an icon boundary pixel point in the updated pixel point set, and cut out a corresponding icon from the image according to position information of the icon boundary pixel point in the image; according to the scheme, the image can be cut based on the position information of the boundary pixels of the icon in the image, namely, the image can be cut according to the actual size of the icon, and the user does not need to adjust the position of the image and other operations during image cutting, so that the image cutting operation is simplified and the image cutting efficiency can be improved compared with the prior art; in addition, because the scheme can cut the graph according to the actual size of the icon, the accuracy of the graph cutting can be improved, and system resources can be saved.
Example III,
In order to better implement the method, an embodiment of the present invention further provides an image processing apparatus, as shown in fig. 3a, which may include a receiving unit 301, an obtaining unit 302, an expanding unit 303, and a cutting unit 304, as follows:
(1) a receiving unit 301;
a receiving unit 301 configured to receive an image processing request indicating an image that needs to be processed, the image including a plurality of icons.
The Icon (Icon) may be any form of computer graphics, such as computer graphics with explicit meaning, for example, the Icon may be a desktop Icon (i.e. software identifier), an interface Icon (i.e. function identifier), or other graphic symbols with meaning, etc.
The image processing request may be triggered by a trigger interface such as a preset trigger key or an input box in the trigger terminal, for example, when a user clicks or swipes an icon, the image processing request is triggered to be generated, that is:
the receiving unit 301 is specifically configured to receive an image processing request triggered by a user through a trigger interface.
(2) An acquisition unit 302;
an obtaining unit 302, configured to obtain a pixel point of the image according to the image processing request, to obtain a pixel point set.
Specifically, the obtaining unit 302 may include: the device comprises an original pixel acquisition subunit, a pixel determination subunit and a set determination subunit;
the original pixel acquisition subunit is used for acquiring pixel points of the image according to the image processing request to obtain an original pixel point set;
the pixel determination subunit is used for determining an effective pixel point and an ineffective pixel point in the original pixel point set;
the set determining subunit is configured to determine a pixel set according to the valid pixel.
(3) An expansion unit 303;
the extension unit 303 is configured to search for an original icon boundary pixel point in the pixel point set, and extend the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel point, so as to update the pixel point set.
Specifically, the extension unit 303 may include: a second lookup subunit and a boundary extension subunit;
the second searching subunit is used for searching the boundary pixel points of the original icon in the pixel point set;
the boundary extension subunit is configured to extend the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel point, so as to update the pixel point set.
For example, the boundary extension subunit may be specifically configured to: drawing a corresponding original icon boundary according to the original icon boundary pixel points, and extending the original icon boundary outwards according to the preset pixel interval, wherein the distance between the extended icon boundary and the original icon boundary is equal to the preset pixel interval.
(4) An update unit 305;
the updating unit 305 is configured to update the pixel point set according to the expanded result.
(5) A cutting unit 305;
the cutting unit 305 is configured to search for an icon boundary pixel point in the updated pixel point set, and cut out a corresponding icon from the image according to the position information of the icon boundary pixel point in the image. For example, the following may be used:
the cutting unit 305 may include: the device comprises a first searching subunit, a boundary determining subunit, a position acquiring subunit and a cutting subunit;
the first searching subunit is used for searching the icon boundary pixel points in the updated pixel point set;
the boundary determining subunit is used for determining icon boundary pixel points belonging to the same icon boundary to obtain a boundary pixel point set corresponding to the icon boundary;
the position obtaining subunit is configured to obtain position information of the image boundary pixel point in the boundary image point set in the image;
the cutting subunit is used for cutting the icon from the image according to the position information.
For example, the cutting subunit may be specifically configured to:
acquiring position offset information corresponding to the preset pixel interval;
acquiring actual position information of the image boundary pixel points in the image in the boundary image point set according to the position offset information and the position information;
and cutting the icon from the image according to the actual position information.
Specifically, the process "cutting the icon from the image according to the actual position information" may include:
acquiring size information corresponding to the icon according to actual position information of the boundary pixel points of the icon in the boundary pixel point set;
and cutting the icon from the image according to the size information and the actual position information.
For another example, the boundary determining subunit is specifically configured to: and determining icon boundary pixel points belonging to the same icon based on the interval between the icon boundary pixel points.
Optionally, to improve flexibility and functional diversity of the cutting, referring to fig. 3b, the image processing apparatus may further include: a region determination unit 306;
the region determining unit 306 is configured to determine whether the image has a protection region or not after the pixel determining subunit determines the valid pixel points and the invalid pixel points, and before the set determining subunit determines the set of pixel points according to the valid pixel points; and if so, determining the invalid pixel points in the protection area as valid pixel points.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
The image processing apparatus may be specifically integrated in a device such as a terminal, and the terminal may be specifically a device such as a mobile phone or a tablet computer.
As can be seen from the above, the image processing apparatus according to the embodiment of the present invention may receive an image processing request through the receiving unit 301, then the obtaining unit 302 obtains a pixel point of the image according to the image processing request to obtain a pixel point set, the expanding unit 303 searches for an original icon boundary pixel point in the pixel point set, and expands an original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel point to update the pixel point set, the cutting unit 305 searches for an icon boundary pixel point in the updated pixel point set, and cuts out a corresponding icon from the image according to location information of the icon boundary pixel point in the image; according to the scheme, the image can be cut based on the position information of the boundary pixels of the icon in the image, namely, the image can be cut according to the actual size of the icon, and the user does not need to adjust the position of the image and other operations during image cutting, so that the image cutting operation is simplified and the image cutting efficiency can be improved compared with the prior art; in addition, because the scheme can cut the graph according to the actual size of the icon, the accuracy of the graph cutting can be improved, and system resources can be saved.
Example four,
In addition, as shown in fig. 4, the terminal may include a Radio Frequency (RF) circuit 401, a memory 402 including one or more computer-readable storage media, an input unit 403, a display unit 404, a sensor 405, an audio circuit 406, a Wireless Fidelity (WiFi) module 407, a processor 408 including one or more processing cores, a power supply 409, and other components. Those skilled in the art will appreciate that the terminal configuration shown in fig. 4 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 401 may be used for receiving and transmitting signals during a message transmission or communication process, and in particular, for receiving downlink information of a base station and then sending the received downlink information to the one or more processors 408 for processing; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuitry 401 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 401 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), and the like.
The memory 402 may be used to store software programs and modules, and the processor 408 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal, etc. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 408 and the input unit 403 access to the memory 402.
The input unit 403 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, in a particular embodiment, the input unit 403 may include a touch-sensitive surface as well as other input devices. The touch-sensitive surface, also referred to as a touch display screen or a touch pad, may collect touch operations by a user (e.g., operations by a user on or near the touch-sensitive surface using a finger, a stylus, or any other suitable object or attachment) thereon or nearby, and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 408, and can receive and execute commands from the processor 408. In addition, touch sensitive surfaces may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. The input unit 403 may include other input devices in addition to the touch-sensitive surface. In particular, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 404 may be used to display information input by or provided to the user and various graphical user interfaces of the terminal, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 404 may include a Display panel, and optionally, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch-sensitive surface may overlay the display panel, and when a touch operation is detected on or near the touch-sensitive surface, the touch operation is transmitted to the processor 408 to determine the type of touch event, and then the processor 408 provides a corresponding visual output on the display panel according to the type of touch event. Although in FIG. 4 the touch-sensitive surface and the display panel are shown as two separate components to implement input and output functions, in some embodiments the touch-sensitive surface may be integrated with the display panel to implement input and output functions.
The terminal may also include at least one sensor 405, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that may turn off the display panel and/or the backlight when the terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal, detailed description is omitted here.
Audio circuitry 406, a speaker, and a microphone may provide an audio interface between the user and the terminal. The audio circuit 406 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electric signal, which is received by the audio circuit 406 and converted into audio data, which is then processed by the audio data output processor 408, and then transmitted to, for example, another terminal via the RF circuit 401, or the audio data is output to the memory 402 for further processing. The audio circuitry 406 may also include an earbud jack to provide peripheral headset communication with the terminal.
WiFi belongs to short distance wireless transmission technology, and the terminal can help the user to send and receive e-mail, browse web page and access streaming media etc. through WiFi module 407, it provides wireless broadband internet access for the user. Although fig. 4 shows the WiFi module 407, it is understood that it does not belong to the essential constitution of the terminal, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 408 is a control center of the terminal, connects various parts of the entire handset using various interfaces and lines, and performs various functions of the terminal and processes data by operating or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby integrally monitoring the handset. Optionally, processor 408 may include one or more processing cores; preferably, the processor 408 may integrate an application processor, which handles primarily the operating system, user interface, applications, etc., and a modem processor, which handles primarily the wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 408.
The terminal also includes a power source 409 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 408 via a power management system to manage charging, discharging, and power consumption via the power management system. The power supply 409 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the terminal may further include a camera, a bluetooth module, and the like, which will not be described herein. Specifically, in this embodiment, the processor 408 in the terminal loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 408 runs the application programs stored in the memory 402, thereby implementing various functions:
receiving an image processing request, the image processing request indicating an image that needs to be processed, the image including a plurality of icons; acquiring pixel points of the image according to the image processing request to obtain a pixel point set; searching an original icon boundary pixel point in the pixel point set, expanding the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel point, and updating the pixel point set according to the expanded result; searching the icon boundary pixel points in the updated pixel point set, and cutting out a corresponding graph from the image according to the position information of the icon boundary pixel points in the image.
Wherein, the step of cutting out the corresponding icon from the image according to the position information of the icon boundary pixel point in the image may include:
determining icon boundary pixel points belonging to the same icon boundary to obtain a boundary pixel point set corresponding to the icon boundary;
acquiring position information of the boundary pixel points of the image in the boundary image point set in the image;
and cutting the icon from the image according to the position information.
For example, the step of "cutting the icon from the image according to the position information" may include:
acquiring position offset information corresponding to the preset pixel interval;
acquiring actual position information of the image boundary pixel points in the image in the boundary image point set according to the position offset information and the position information;
and cutting the icon from the image according to the actual position information.
Specifically, the step of "cutting the icon from the image according to the actual position information" may include:
acquiring size information corresponding to the icon according to actual position information of the boundary pixel points of the icon in the boundary pixel point set;
and cutting the icon from the image according to the size information and the actual position information.
For another example, the step of "determining icon boundary pixel points belonging to the same icon" may include: and determining icon boundary pixel points belonging to the same icon based on the interval between the icon boundary pixel points.
The above operations or operation steps can be referred to the foregoing method embodiments, and are not described herein again.
From the above, it can be seen that the terminal of the embodiment of the present invention
When an image processing request is received, acquiring pixel points of the image according to the image processing request to obtain a pixel point set, searching original icon boundary pixel points in the pixel point set, expanding an original icon boundary of an icon according to a preset pixel interval and the original icon boundary pixel points, updating the pixel point set according to an expansion result, searching icon boundary pixel points in the updated pixel point set, and cutting out a corresponding icon from the image according to position information of the icon boundary pixel points in the image; according to the scheme, the image can be cut based on the position information of the boundary pixels of the icon in the image, namely, the image can be cut according to the actual size of the icon, and the user does not need to adjust the position of the image and other operations during image cutting, so that the image cutting operation is simplified and the image cutting efficiency can be improved compared with the prior art; in addition, because the scheme can cut the graph according to the actual size of the icon, the accuracy of the graph cutting can be improved, and system resources can be saved.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The foregoing detailed description is directed to an image processing method and apparatus according to an embodiment of the present invention, and the principles and embodiments of the present invention are described herein by using specific examples, which are merely used to help understand the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (14)

1. An image processing method, comprising:
receiving an image processing request, the image processing request indicating an image that needs to be processed, the image including a plurality of icons;
acquiring pixel points of the image according to the image processing request to obtain a pixel point set;
searching original icon boundary pixel points in the pixel point set, and expanding the original icon boundary of the icon according to a preset pixel interval and the original icon boundary pixel points;
updating the pixel point set according to the expansion result;
searching icon boundary pixel points in the updated pixel point set, determining icon boundary pixel points belonging to the same icon boundary, and obtaining a boundary pixel point set corresponding to the icon boundary;
acquiring position information of the image boundary pixel points in the boundary pixel point set in the image;
and cutting the icon from the image according to the position information.
2. The image processing method of claim 1, wherein said cutting the icon from the image according to the position information comprises:
acquiring position offset information corresponding to the preset pixel interval;
acquiring actual position information of the image boundary pixel points in the image in the boundary pixel point set according to the position offset information and the position information;
and cutting the icon from the image according to the actual position information.
3. The image processing method of claim 2, wherein said cutting the icon from the image according to the actual position information comprises:
acquiring size information corresponding to the icon according to actual position information of the icon boundary pixel points in the boundary pixel point set;
and cutting the icon from the image according to the size information and the actual position information.
4. The image processing method of claim 1, wherein said determining icon boundary pixel points belonging to the same icon comprises:
and determining icon boundary pixel points belonging to the same icon based on the interval between the icon boundary pixel points.
5. The image processing method of claim 1, wherein the expanding the original icon boundary of the icon according to the preset pixel interval and the original icon boundary pixel point comprises:
drawing a corresponding original icon boundary according to the original icon boundary pixel points;
and extending the original icon boundary outwards according to the preset pixel interval, wherein the distance between the extended icon boundary and the original icon boundary is equal to the preset pixel interval.
6. The image processing method according to claim 1, wherein the obtaining of the pixel point of the image according to the image processing request to obtain a pixel point set comprises:
acquiring pixel points of the image according to the image processing request to obtain an original pixel point set;
determining effective pixel points and ineffective pixel points in the original pixel point set;
and determining a pixel point set according to the effective pixel points.
7. The image processing method according to claim 6, wherein after determining the valid pixel and the invalid pixel in the original pixel set, before determining the pixel set based on the valid pixel, the image processing method further comprises:
determining whether the image is provided with a protection area;
and if so, determining the invalid pixel points in the protection area as valid pixel points.
8. An image processing apparatus characterized by comprising:
a receiving unit configured to receive an image processing request indicating an image that needs to be processed, the image including a plurality of icons;
the acquisition unit is used for acquiring pixel points of the image according to the image processing request to obtain a pixel point set;
the expansion unit is used for searching pixel points of the boundary of the original icon in the pixel point set and expanding the boundary of the original icon of the icon according to a preset pixel interval and the pixel points of the boundary of the original icon;
the updating unit is used for updating the pixel point set according to the expansion result;
a cutting unit comprising: the device comprises a first searching subunit, a boundary determining subunit, a position acquiring subunit and a cutting subunit;
the first searching subunit is used for searching the icon boundary pixel points in the updated pixel point set;
the boundary determining subunit is used for determining icon boundary pixel points belonging to the same icon boundary to obtain a boundary pixel point set corresponding to the icon boundary;
the position obtaining subunit is configured to obtain position information of the image border pixel points in the border pixel point set in the image;
the cutting subunit is configured to cut the icon from the image according to the position information.
9. The image processing apparatus of claim 8, wherein the cutting subunit is to:
acquiring position offset information corresponding to the preset pixel interval;
acquiring actual position information of the image boundary pixel points in the image in the boundary pixel point set according to the position offset information and the position information;
and cutting the icon from the image according to the actual position information.
10. The image processing apparatus of claim 9, wherein the cutting subunit is to: acquiring size information corresponding to the icon according to actual position information of the icon boundary pixel points in the boundary pixel point set; and cutting the icon from the image according to the size information and the actual position information.
11. The image processing apparatus according to claim 8, wherein the boundary determining subunit is operable to: and determining icon boundary pixel points belonging to the same icon based on the interval between the icon boundary pixel points.
12. The image processing apparatus according to claim 8, wherein the extension unit includes:
the second searching subunit is used for drawing a corresponding original icon boundary according to the original icon boundary pixel points;
and the boundary extension subunit is used for extending the original icon boundary outwards according to the preset pixel interval, wherein the distance between the extended icon boundary and the original icon boundary is equal to the preset pixel interval.
13. The image processing apparatus according to claim 8, wherein the acquisition unit includes:
an original pixel obtaining subunit, configured to obtain, according to the image processing request, pixel points of the image, and obtain an original pixel point set;
the pixel determining subunit is used for determining effective pixel points and ineffective pixel points in the original pixel point set;
and the set determining subunit is used for determining a pixel point set according to the effective pixel points.
14. A computer-readable storage medium storing a computer program for image processing, wherein the computer program causes a computer to perform the method according to any one of claims 1-7.
CN201610539785.9A 2016-07-08 2016-07-08 Image processing method and device Active CN106204588B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610539785.9A CN106204588B (en) 2016-07-08 2016-07-08 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610539785.9A CN106204588B (en) 2016-07-08 2016-07-08 Image processing method and device

Publications (2)

Publication Number Publication Date
CN106204588A CN106204588A (en) 2016-12-07
CN106204588B true CN106204588B (en) 2020-03-17

Family

ID=57473510

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610539785.9A Active CN106204588B (en) 2016-07-08 2016-07-08 Image processing method and device

Country Status (1)

Country Link
CN (1) CN106204588B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106846353B (en) * 2017-01-04 2020-02-21 美的集团股份有限公司 Density-based image processing method, image processing apparatus and device
CN107463697A (en) * 2017-08-15 2017-12-12 腾讯科技(深圳)有限公司 Method of adjustment, device and the computer-readable storage medium of picture size
CN110660029B (en) * 2019-09-12 2022-05-06 深兰科技(上海)有限公司 Image processing method, device, equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101493735A (en) * 2008-01-21 2009-07-29 宏碁股份有限公司 Touch control plate operating system and method
CN101727656A (en) * 2008-10-31 2010-06-09 李德毅 Image segmenting method based on data field
CN102111640A (en) * 2010-11-30 2011-06-29 广东威创视讯科技股份有限公司 Effective image area detection method and system
CN102495727A (en) * 2011-10-25 2012-06-13 福州博远无线网络科技有限公司 Method for synthesizing icons in interface of intelligent handheld device system
CN102572205A (en) * 2011-12-27 2012-07-11 方正国际软件有限公司 Image processing method, device and system
CN102622163A (en) * 2011-03-14 2012-08-01 北京小米科技有限责任公司 Icon generation method
CN103248796A (en) * 2012-02-01 2013-08-14 佳能株式会社 Image processing apparatus and method
CN104091332A (en) * 2014-07-01 2014-10-08 黄河科技学院 Method for optimizing multilayer image segmentation of multiclass color texture images based on variation model
CN105389165A (en) * 2015-10-21 2016-03-09 广州视睿电子科技有限公司 Document picture display method and apparatus, and terminal

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101493735A (en) * 2008-01-21 2009-07-29 宏碁股份有限公司 Touch control plate operating system and method
CN101727656A (en) * 2008-10-31 2010-06-09 李德毅 Image segmenting method based on data field
CN102111640A (en) * 2010-11-30 2011-06-29 广东威创视讯科技股份有限公司 Effective image area detection method and system
CN102622163A (en) * 2011-03-14 2012-08-01 北京小米科技有限责任公司 Icon generation method
CN102495727A (en) * 2011-10-25 2012-06-13 福州博远无线网络科技有限公司 Method for synthesizing icons in interface of intelligent handheld device system
CN102572205A (en) * 2011-12-27 2012-07-11 方正国际软件有限公司 Image processing method, device and system
CN103248796A (en) * 2012-02-01 2013-08-14 佳能株式会社 Image processing apparatus and method
CN104091332A (en) * 2014-07-01 2014-10-08 黄河科技学院 Method for optimizing multilayer image segmentation of multiclass color texture images based on variation model
CN105389165A (en) * 2015-10-21 2016-03-09 广州视睿电子科技有限公司 Document picture display method and apparatus, and terminal

Also Published As

Publication number Publication date
CN106204588A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
CN106775637B (en) Page display method and device for application program
KR102038209B1 (en) Method and device for displaying web page annotations, and mobile terminal
CN106406712B (en) Information display method and device
US9740671B2 (en) Method and apparatus of generating a webpage from an original design file comprising layers
US20150082231A1 (en) Method and terminal for displaying desktop
CN105786878B (en) Display method and device of browsing object
CN107193518B (en) Information display method and terminal equipment
CN108205398B (en) Method and device for adapting webpage animation to screen
CN105975190B (en) Graphical interface processing method, device and system
CN106780684B (en) Animation effect realization method and device
CN105989572B (en) Picture processing method and device
US9798713B2 (en) Method for configuring application template, method for launching application template, and mobile terminal device
CN110795666A (en) Webpage generation method, device, terminal and storage medium
CN111580815B (en) Page element editing method and related equipment
CN109726368B (en) Map marking method and device
CN104252356A (en) Interface generating method and system
US9824476B2 (en) Method for superposing location information on collage, terminal and server
CN106204588B (en) Image processing method and device
CN105653112B (en) Method and device for displaying floating layer
CN103399657A (en) Mouse pointer control method, device and terminal device
CN103455588A (en) Image indexing method and device
CN105095161B (en) Method and device for displaying rich text information
CN106230919B (en) File uploading method and device
CN104238931B (en) Information input method and device and electronic equipment
CN110717486B (en) Text detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 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