CN107797972B - Method and terminal for displaying characters - Google Patents

Method and terminal for displaying characters Download PDF

Info

Publication number
CN107797972B
CN107797972B CN201711017194.6A CN201711017194A CN107797972B CN 107797972 B CN107797972 B CN 107797972B CN 201711017194 A CN201711017194 A CN 201711017194A CN 107797972 B CN107797972 B CN 107797972B
Authority
CN
China
Prior art keywords
pixel point
character
picture
square
average gray
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
CN201711017194.6A
Other languages
Chinese (zh)
Other versions
CN107797972A (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.)
Fujian Netdragon Websoft Co Ltd
Original Assignee
Fujian Netdragon Websoft 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 Fujian Netdragon Websoft Co Ltd filed Critical Fujian Netdragon Websoft Co Ltd
Priority to CN201711017194.6A priority Critical patent/CN107797972B/en
Publication of CN107797972A publication Critical patent/CN107797972A/en
Application granted granted Critical
Publication of CN107797972B publication Critical patent/CN107797972B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The present invention relates to the field of data processing, and in particular, to a method and a terminal for displaying characters. The method is suitable for any terminal with a screen and application scene, does not need a client or an operating system to provide a corresponding interface for adjusting the font size, and has better compatibility and universality.

Description

Method and terminal for displaying characters
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and a terminal for displaying characters.
Background
The existing way to adjust the size of the characters displayed on the screen is to adjust the default font size of the system or the corresponding client. However, in some application scenarios, the size of the characters displayed on the screen may not be adjusted. For example, some clients do not provide an interface for font resizing, the iOS system desktop icon name is not resizable, and so on. When the system or the client does not provide the function of adjusting the font size, the use is very inconvenient for the user.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: how to provide a universal method and terminal for adjusting the size of characters displayed on a screen.
In order to solve the technical problems, the invention adopts the technical scheme that:
the invention provides a method for displaying characters, which comprises the following steps:
intercepting a currently displayed image on a screen to obtain a picture;
scaling characters in the picture.
The present invention also provides a terminal for displaying characters, comprising one or more processors and a memory, the memory storing a program and configured to perform the following steps by the one or more processors:
intercepting a currently displayed image on a screen to obtain a picture;
scaling characters in the picture.
The invention has the beneficial effects that: the method is suitable for any terminal with a screen and application scene, does not need a client or an operating system to provide a corresponding interface for adjusting the font size, and has better compatibility and universality.
Drawings
FIG. 1 is a block flow diagram of an embodiment of a method for displaying characters according to the present invention;
fig. 2 is a block diagram illustrating a terminal for displaying characters according to an embodiment of the present invention;
description of reference numerals:
1. a processor; 2. A memory.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1 and fig. 2,
as shown in fig. 1, the present invention provides a method for displaying characters, comprising:
intercepting a currently displayed image on a screen to obtain a picture;
scaling characters in the picture.
Further, scaling the characters in the picture specifically includes:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value;
s3, zooming the area in the size range of the picture.
According to the description, the pixel points in the picture are divided into the background part and the character part through the average gray value of the picture, the minimum area covering one character is identified according to the pixel points belonging to the character part, and the minimum area covering one character is zoomed in the size range of the picture, so that the characters in the picture are zoomed under the condition that the size of the picture is not changed, the compatibility with different resolution equipment is improved, and the user experience is improved.
Further, the S2 specifically includes:
acquiring pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
and identifying a minimum area covering a character in the picture according to the character pixel point set.
As can be seen from the above description, in general, in order to highlight the character portion, the grayscale value of the background color is higher than the grayscale value of the character, for example, the grayscale value corresponding to the background of the picture being white is 255, and the grayscale value corresponding to the character color being black is 0. According to the invention, the pixel points in the picture are divided into the character part and the background part through the average gray value of the picture, so that the noise interference can be reduced, and the accuracy of identifying the minimum region capable of covering one character is improved.
Further, identifying a minimum area covering a character in the picture according to the character pixel point set, specifically:
s21, presetting an initial side length;
s22, setting the color of each pixel point in the character pixel point set to be black;
s23, setting the colors of other pixel points in the picture except the character pixel point set to be white;
s24, acquiring a pixel point in the character pixel point set to obtain a vertex pixel point;
s25, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s26, acquiring points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s27, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s28, repeating the steps S26 to S27 until no black pixel point exists in the second pixel point set;
and S29, setting the area where the second square is located as the minimum area covering one character in the picture.
According to the description, the pixel points belonging to the character part are set to be black, and the pixel points belonging to the background part are set to be white, so that whether the pixel points belong to the character part or not can be directly judged according to the colors of the pixel points in the process of scanning the picture, and the efficiency of identifying the minimum area capable of covering one character is improved.
Further, before S29, the method further includes:
presetting an initial value and an end value;
calculating the average gray value in the area where the second square is located to obtain a second average gray value;
acquiring a central pixel point of the second square to obtain a central point;
presetting a first side length, wherein the first side length is larger than the initial side length;
sa, drawing a third square corresponding to the first side length by taking the central point as a center;
sb, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating the steps Sa to Sb; otherwise, go to step S29;
when the third average gradation value is greater than the second average gradation value, steps S24 to S29 are performed.
From the above description, it can be known whether a pixel point belonging to a character part still exists near the boundary of the second square through the average gray value of the third square whose area is larger than that of the second square, if so, the character part is continuously scanned, and if not, the second square is the minimum area capable of covering a character, so that the accuracy of identifying the minimum area capable of covering a character is improved.
Further, the S24 specifically includes:
acquiring a line of pixel points which are not scanned in the picture according to the sequence from top to bottom;
acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right;
and setting the pixel point as a vertex pixel point.
From the above description, it can be known that missing of pixel points belonging to the character part is effectively avoided.
Further, the S3 specifically includes:
identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set;
and in the size range of the picture, scaling all the areas in the first character area set in an equal proportion manner to obtain a second character area set.
As can be seen from the above description, scaling of only the character portion in the picture is achieved without changing the background portion in the picture.
Further, after all the regions in the first character region set are scaled in equal proportion to obtain a second character region set, the method further includes:
acquiring the width of the region in the second character region set to obtain the character width;
calculating the number of characters in each line according to the character width and the picture width;
and displaying the characters according to the number of the characters in each line.
From the above description, the adaptive typesetting in the zooming process improves the compatibility.
As shown in fig. 2, the present invention also provides a terminal for displaying characters, comprising one or more processors 1 and a memory 2, wherein the memory 2 stores programs and is configured to be executed by the one or more processors 1 to perform the following steps:
intercepting a currently displayed image on a screen to obtain a picture;
scaling characters in the picture.
Further, scaling the characters in the picture specifically includes:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value;
s3, zooming the area in the size range of the picture.
Further, the S2 specifically includes:
acquiring pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
and identifying a minimum area covering a character in the picture according to the character pixel point set.
Further, identifying a minimum area covering a character in the picture according to the character pixel point set, specifically:
s21, presetting an initial side length;
s22, setting the color of each pixel point in the character pixel point set to be black;
s23, setting the colors of other pixel points in the picture except the character pixel point set to be white;
s24, acquiring a pixel point in the character pixel point set to obtain a vertex pixel point;
s25, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s26, acquiring points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s27, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s28, repeating the steps S26 to S27 until no black pixel point exists in the second pixel point set;
and S29, setting the area where the second square is located as the minimum area covering one character in the picture.
Further, before S29, the method further includes:
presetting an initial value and an end value;
calculating the average gray value in the area where the second square is located to obtain a second average gray value;
acquiring a central pixel point of the second square to obtain a central point;
presetting a first side length, wherein the first side length is larger than the initial side length;
sa, drawing a third square corresponding to the first side length by taking the central point as a center;
sb, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating the steps Sa to Sb; otherwise, go to step S29;
when the third average gradation value is greater than the second average gradation value, steps S24 to S29 are performed.
Further, the S24 specifically includes:
acquiring a line of pixel points which are not scanned in the picture according to the sequence from top to bottom;
acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right;
and setting the pixel point as a vertex pixel point.
Further, the S3 specifically includes:
identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set;
and in the size range of the picture, scaling all the areas in the first character area set in an equal proportion manner to obtain a second character area set.
Further, after all the regions in the first character region set are scaled in equal proportion to obtain a second character region set, the method further includes:
acquiring the width of the region in the second character region set to obtain the character width;
calculating the number of characters in each line according to the character width and the picture width;
and displaying the characters according to the number of the characters in each line.
The first embodiment of the invention is as follows:
the embodiment provides a method for displaying characters, which comprises the following steps:
step a, intercepting a currently displayed image of a screen to obtain a picture;
step b, zooming characters in the picture;
wherein Step b is specifically as follows:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value; the method specifically comprises the following steps:
s21, obtaining pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
s22, identifying a minimum area covering a character in the picture according to the character pixel point set; the method specifically comprises the following steps:
s221, presetting an initial side length;
optionally, the initial side length is 16 pixels, because the minimum requirement of Chinese characters is 16x16 pixel point representation;
s222, setting the color of each pixel point in the character pixel point set to be black;
s223, setting the color of other pixel points in the picture except the character pixel point set to be white;
s224, obtaining a pixel point in the character pixel point set to obtain a vertex pixel point;
optionally, a row of pixel points which are not scanned in the picture are obtained according to the sequence from top to bottom; acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right; setting the pixel point as a vertex pixel point;
s225, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s226, obtaining points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s227, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s228, repeating the steps from the step S226 to the step S227 until no black pixel point exists in the second pixel point set;
s229, presetting an initial value and an end value;
s230, calculating the average gray value in the area where the second square is located to obtain a second average gray value;
s231, obtaining a central pixel point of the second square to obtain a central point;
s232, presetting a first side length, wherein the first side length is larger than the initial side length;
s233, drawing a third square corresponding to the first side length by taking the central point as a center;
s234, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
s235, when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating steps S233 to S234; otherwise, step S237 is executed;
s236, when the third average gray-scale value is larger than the second average gray-scale value, executing the steps S224 to S236;
s237, setting the area where the second square is located as the minimum area covering one character in the picture;
s3, zooming the area in the size range of the picture; the method specifically comprises the following steps: identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set; in the size range of the picture, scaling all the areas in the first character area set in an equal proportion mode to obtain a second character area set; acquiring the width of the region in the second character region set to obtain the character width; calculating the number of characters in each line according to the character width and the picture width; and displaying the characters according to the number of the characters in each line.
For example, the left-most abscissa of the "text" is (100 ) to (110, 100). The coordinates of the radical "dian" are (103, 98) (104, 99), (105, 100); and searching black pixel points in the picture from left to right from top to bottom, and if (100 ) is searched, taking (100 ) as a starting point, tiling (100 ) to (116, 116) square areas. Then, detecting whether black exists on two line segments from (100 ) to (116, 100) and from (100 ) to (100, 116), and detecting that black pixel points exist on (105, 100); detecting points (105, 100) at the left lower, left, top right, detecting points at the top left (104, 99) with black pixels, moving the square region up to (100, 99) to (100, 115) and so on until the square region moves to the top of the left-falling (100, 98) to (100, 114) square region.
The second embodiment of the invention is as follows:
the present embodiment provides a terminal for displaying characters, including one or more processors and a memory, where the memory stores programs and is configured to be executed by the one or more processors to perform the following steps:
step a, intercepting a currently displayed image of a screen to obtain a picture;
step b, zooming characters in the picture;
wherein Step b is specifically as follows:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value; the method specifically comprises the following steps:
s21, obtaining pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
s22, identifying a minimum area covering a character in the picture according to the character pixel point set; the method specifically comprises the following steps:
s221, presetting an initial side length;
optionally, the initial side length is 16 pixels, because the minimum requirement of Chinese characters is 16x16 pixel point representation;
s222, setting the color of each pixel point in the character pixel point set to be black;
s223, setting the color of other pixel points in the picture except the character pixel point set to be white;
s224, obtaining a pixel point in the character pixel point set to obtain a vertex pixel point;
optionally, a row of pixel points which are not scanned in the picture are obtained according to the sequence from top to bottom; acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right; setting the pixel point as a vertex pixel point;
s225, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s226, obtaining points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s227, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s228, repeating the steps from the step S226 to the step S227 until no black pixel point exists in the second pixel point set;
s229, presetting an initial value and an end value;
s230, calculating the average gray value in the area where the second square is located to obtain a second average gray value;
s231, obtaining a central pixel point of the second square to obtain a central point;
s232, presetting a first side length, wherein the first side length is larger than the initial side length;
s233, drawing a third square corresponding to the first side length by taking the central point as a center;
s234, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
s235, when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating steps S233 to S234; otherwise, step S237 is executed;
s236, when the third average gray-scale value is larger than the second average gray-scale value, executing the steps S224 to S236;
s237, setting the area where the second square is located as the minimum area covering one character in the picture;
s3, zooming the area in the size range of the picture; the method specifically comprises the following steps: identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set; in the size range of the picture, scaling all the areas in the first character area set in an equal proportion mode to obtain a second character area set; acquiring the width of the region in the second character region set to obtain the character width; calculating the number of characters in each line according to the character width and the picture width; and displaying the characters according to the number of the characters in each line.
In summary, the method and the terminal for displaying characters provided by the present invention implement the adjustment of the size of the characters displayed on the screen by capturing the image currently displayed on the screen and scaling the characters in the captured image. Further, pixel points in the picture are divided into a background part and a character part through the average gray value of the picture, a minimum area covering a character is identified according to the pixel points belonging to the character part, and the minimum area covering the character is zoomed in the size range of the picture, so that characters in the picture are zoomed under the condition that the size of the picture is not changed, the compatibility with devices with different resolutions is improved, and the user experience is improved. Furthermore, pixel points in the picture are divided into a character part and a background part through the average gray value of the picture, so that the noise interference can be reduced, and the accuracy of identifying the minimum area capable of covering one character is improved. Furthermore, the pixel points belonging to the character part are set to be black, and the pixel points belonging to the background part are set to be white, so that whether the pixel points belong to the character part or not can be directly judged according to the color of the pixel points in the process of scanning the picture, and the efficiency of identifying the minimum area capable of covering one character is improved. Further, whether pixel points belonging to the character part still exist near the boundary of the second square can be known through the average gray value of a third square with the area larger than that of the second square, if yes, the character part is continuously scanned, and if not, the second square is a minimum area capable of covering a character, so that the accuracy of identifying the minimum area capable of covering the character is improved. Further, the omission of pixel points belonging to the character part is effectively avoided. Further, only the character part in the picture is zoomed, and the background part in the picture is not changed. Furthermore, self-adaptive typesetting is performed in the zooming process, and compatibility is improved.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (8)

1. A method of displaying characters, comprising:
intercepting a currently displayed image on a screen to obtain a picture;
zooming characters in the picture;
zooming the characters in the picture specifically comprises the following steps:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value;
s3, zooming the area in the size range of the picture;
wherein, the S2 specifically is:
acquiring pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
identifying a minimum area covering a character in the picture according to the character pixel point set;
identifying a minimum area covering a character in the picture according to the character pixel point set, specifically:
s21, presetting an initial side length;
s22, setting the color of each pixel point in the character pixel point set to be black;
s23, setting the colors of other pixel points in the picture except the character pixel point set to be white;
s24, acquiring a pixel point in the character pixel point set to obtain a vertex pixel point;
s25, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s26, acquiring points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s27, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s28, repeating the steps S26 to S27 until no black pixel point exists in the second pixel point set;
s29, setting the area where the second square is located as the minimum area covering a character in the picture;
before S29, the method further includes:
presetting an initial value and an end value;
calculating the average gray value in the area where the second square is located to obtain a second average gray value;
acquiring a central pixel point of the second square to obtain a central point;
presetting a first side length, wherein the first side length is larger than the initial side length;
sa, drawing a third square corresponding to the first side length by taking the central point as a center;
sb, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating the steps Sa to Sb; otherwise, go to step S29;
when the third average gradation value is greater than the second average gradation value, steps S24 to S29 are performed.
2. The method for displaying characters according to claim 1, wherein the S24 is specifically:
acquiring a line of pixel points which are not scanned in the picture according to the sequence from top to bottom;
acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right;
and setting the pixel point as a vertex pixel point.
3. The method for displaying characters according to claim 1, wherein the S3 is specifically:
identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set;
and in the size range of the picture, scaling all the areas in the first character area set in an equal proportion manner to obtain a second character area set.
4. The method of claim 3, wherein after scaling all the regions in the first set of character regions to obtain a second set of character regions, further comprising:
acquiring the width of the region in the second character region set to obtain the character width;
calculating the number of characters in each line according to the character width and the picture width;
and displaying the characters according to the number of the characters in each line.
5. A terminal for displaying characters, comprising one or more processors and a memory, the memory storing a program and configured to perform the following steps by the one or more processors:
intercepting a currently displayed image on a screen to obtain a picture;
zooming characters in the picture;
zooming the characters in the picture specifically comprises the following steps:
s1, calculating the average gray value of the picture to obtain a first average gray value;
s2, identifying a minimum area covering a character in the picture according to the first average gray value;
s3, zooming the area in the size range of the picture;
wherein, the S2 specifically is:
acquiring pixel points of which the gray values are smaller than the first average gray value in the picture to obtain a character pixel point set;
identifying a minimum area covering a character in the picture according to the character pixel point set;
identifying a minimum area covering a character in the picture according to the character pixel point set, specifically:
s21, presetting an initial side length;
s22, setting the color of each pixel point in the character pixel point set to be black;
s23, setting the colors of other pixel points in the picture except the character pixel point set to be white;
s24, acquiring a pixel point in the character pixel point set to obtain a vertex pixel point;
s25, drawing a first square corresponding to the initial side length by taking the vertex pixel point as the top left corner of the square;
s26, acquiring points with the distance from the vertex pixel points smaller than the preset distance to obtain a second pixel point set;
s27, when the second pixel point set comprises a black pixel point and the abscissa of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square; when the second pixel point set comprises a black pixel point and the vertical coordinate of the black pixel point is smaller than that of the pixel point, updating the black pixel point as a vertex pixel point, and drawing a second square corresponding to the initial side length by taking the black pixel point as the top left corner vertex of the square;
s28, repeating the steps S26 to S27 until no black pixel point exists in the second pixel point set;
s29, setting the area where the second square is located as the minimum area covering a character in the picture;
before S29, the method further includes:
presetting an initial value and an end value;
calculating the average gray value in the area where the second square is located to obtain a second average gray value;
acquiring a central pixel point of the second square to obtain a central point;
presetting a first side length, wherein the first side length is larger than the initial side length;
sa, drawing a third square corresponding to the first side length by taking the central point as a center;
sb, calculating the average gray value in the area where the third square is located to obtain a third average gray value;
when the third average gray value is smaller than the second average gray value, increasing the first edge length by a preset edge length value; adding one to the initial value; if the initial value is smaller than the end value, repeating the steps Sa to Sb; otherwise, go to step S29;
when the third average gradation value is greater than the second average gradation value, steps S24 to S29 are performed.
6. The terminal for displaying characters according to claim 5, wherein said S24 is specifically:
acquiring a line of pixel points which are not scanned in the picture according to the sequence from top to bottom;
acquiring an unscanned pixel point in the row of pixel points according to the sequence from left to right;
and setting the pixel point as a vertex pixel point.
7. The terminal for displaying characters according to claim 5, wherein said S3 is specifically:
identifying regions corresponding to all characters in the picture according to the steps S1 to S2 to obtain a first character region set;
and in the size range of the picture, scaling all the areas in the first character area set in an equal proportion manner to obtain a second character area set.
8. The terminal for displaying characters according to claim 7, wherein after scaling all the regions in the first set of character regions to obtain the second set of character regions, further comprising:
acquiring the width of the region in the second character region set to obtain the character width;
calculating the number of characters in each line according to the character width and the picture width;
and displaying the characters according to the number of the characters in each line.
CN201711017194.6A 2017-10-26 2017-10-26 Method and terminal for displaying characters Active CN107797972B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711017194.6A CN107797972B (en) 2017-10-26 2017-10-26 Method and terminal for displaying characters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711017194.6A CN107797972B (en) 2017-10-26 2017-10-26 Method and terminal for displaying characters

Publications (2)

Publication Number Publication Date
CN107797972A CN107797972A (en) 2018-03-13
CN107797972B true CN107797972B (en) 2020-12-18

Family

ID=61548082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711017194.6A Active CN107797972B (en) 2017-10-26 2017-10-26 Method and terminal for displaying characters

Country Status (1)

Country Link
CN (1) CN107797972B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110126458B (en) * 2019-04-01 2021-01-05 桂林市朗谷科技有限公司 Automatic PCB screen printing adjusting method and device and storage medium
CN112053203A (en) * 2020-08-14 2020-12-08 中国物品编码中心 Commodity picture display method and device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877062A (en) * 2009-12-21 2010-11-03 汉王科技股份有限公司 Method for profile analysis in image layout area
CN103092989A (en) * 2013-02-08 2013-05-08 广州市渡明信息技术有限公司 Image display method and device adaptable to terminal screen
CN104700357A (en) * 2015-04-14 2015-06-10 华东理工大学 Chinese character image zooming method based on bilinear operator

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6731753B2 (en) * 2016-03-07 2020-07-29 キヤノン株式会社 Image processing apparatus, image processing method, image processing system and program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877062A (en) * 2009-12-21 2010-11-03 汉王科技股份有限公司 Method for profile analysis in image layout area
CN103092989A (en) * 2013-02-08 2013-05-08 广州市渡明信息技术有限公司 Image display method and device adaptable to terminal screen
CN104700357A (en) * 2015-04-14 2015-06-10 华东理工大学 Chinese character image zooming method based on bilinear operator

Also Published As

Publication number Publication date
CN107797972A (en) 2018-03-13

Similar Documents

Publication Publication Date Title
GB2533692B (en) Auto-contrast viewfinder for an indicia reader
CN108257580B (en) Display picture adjusting method and device based on backlight brightness
JP3870109B2 (en) Image display apparatus, image display method, and image display program
US8861854B2 (en) Character recognition apparatus, method, and computer-readable, non-transitory medium
JP4903577B2 (en) Video signal converter, video display device
CN108965839B (en) Method and device for automatically adjusting projection picture
CN107797972B (en) Method and terminal for displaying characters
JP2001056673A (en) Technique for displaying complicated character
CN110502205B (en) Picture display edge processing method and device, electronic equipment and readable storage medium
JP2010108389A (en) Image display device and program
CN104361335B (en) A kind of processing method that black surround is automatically removed based on scan image
US7724981B2 (en) Adaptive contrast control systems and methods
CN110736610A (en) Method and device for measuring optical center deviation, storage medium and depth camera
JP2010056827A (en) Apparatus and program for processing image
US20110249895A1 (en) Compensating for fill-in artifact effect via tone-dependent dilation of pixels in a digital color image
US20150138045A1 (en) Vehicle head unit and method for setting screen of vehicle head unit
JP6516103B2 (en) Image processing apparatus, image processing method and image processing program
US20150029204A1 (en) Dynamic localized contrast enhancement method for image and computer readable medium of the same
CN107944449B (en) Method and terminal for scaling characters
US20230071008A1 (en) Computer-readable, non-transitory recording medium containing therein image processing program for generating learning data of character detection model, and image processing apparatus
CN104933430A (en) Interactive image processing method and interactive image processing system for mobile terminal
US7957594B2 (en) Outline definition apparatus and outline definition method, and image processing apparatus
CN106604105B (en) Calculate the method and device of HBBTV application image size
US10015339B2 (en) Image reading apparatus, image reading method, and recording medium therefor, that improve quality of image of document obtained by portable image device
JP2010219848A (en) Document image processor and document image processing method

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