CN108961351B - Method, device, system and storage medium for realizing fractal graph drawing through compression - Google Patents

Method, device, system and storage medium for realizing fractal graph drawing through compression Download PDF

Info

Publication number
CN108961351B
CN108961351B CN201810867276.8A CN201810867276A CN108961351B CN 108961351 B CN108961351 B CN 108961351B CN 201810867276 A CN201810867276 A CN 201810867276A CN 108961351 B CN108961351 B CN 108961351B
Authority
CN
China
Prior art keywords
compression
diagram
current
image
drawn
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
CN201810867276.8A
Other languages
Chinese (zh)
Other versions
CN108961351A (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.)
Wuhan Polytechnic University
Original Assignee
Wuhan Polytechnic University
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 Wuhan Polytechnic University filed Critical Wuhan Polytechnic University
Priority to CN201810867276.8A priority Critical patent/CN108961351B/en
Publication of CN108961351A publication Critical patent/CN108961351A/en
Application granted granted Critical
Publication of CN108961351B publication Critical patent/CN108961351B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method, equipment, a system and a storage medium for realizing fractal drawing through compression. The method comprises the steps of compressing pixel points of an area to be drawn based on IFS codes of an original image to be drawn to obtain an initial compression image, taking the initial compression image as a current compression image, compressing the current compression image based on the IFS codes of the original image to be drawn to obtain an undetermined compression image, matching the current compression image with the undetermined compression image to obtain a matching result, taking the undetermined compression image as the current compression image when the matching result is that the matching fails, returning the IFS codes of the original image to be drawn to compress the current compression image to obtain the undetermined compression image, and taking the undetermined compression image as a fractal image of the original image to be drawn when the matching result is that the matching succeeds.

Description

Method, device, system and storage medium for realizing fractal graph drawing through compression
Technical Field
The invention relates to the technical field of fractal graphs, in particular to a method, equipment, a system and a storage medium for realizing fractal graph drawing through compression.
Background
Although the random iteration method can draw any fractal graph with IFS codes, the complete drawing process cannot be intuitively understood, and in fact, the fractal graph serving as an attractor can be drawn in a step-by-step compression mode. Because of the limitation of the self resolution of the computer display, after the fractal graph is compressed to a certain number of times, the pixel points in the fractal graph are not changed any more, if the number of compression times is less than the number of compression times, the obtained graph is an approximate value of the fractal graph, and if the number of compression times is more than the number of compression times, although the drawn graph is the fractal graph, more drawing time is consumed. Therefore, if this number of compression times can be accurately known, time for drawing the fractal graph by the compression method can be surely saved.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a method, equipment, a system and a storage medium for realizing fractal drawing through compression, and aims to solve the technical problem that the drawing process of a fractal drawing cannot be intuitively understood when the fractal drawing is drawn through a random iteration method in the prior art.
In order to achieve the above object, the present invention provides a method for implementing fractal graph drawing through compression, including the following steps:
acquiring an IFS code of an original image to be drawn;
compressing pixel points of an area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and taking the initial compression image as a current compression image;
compressing the current compression diagram based on the IFS code of the original diagram to be drawn to obtain a diagram to be compressed;
matching the current compression diagram with a to-be-determined compression diagram to obtain a matching result;
when the matching result is matching failure, taking the pending compression graph as a current compression graph, and returning the IFS code based on the original graph to be drawn to compress the current compression graph to obtain the pending compression graph;
and when the matching result is that the matching is successful, taking the image to be compressed as a fractal image of the original image to be drawn.
Preferably, the matching the current compression map and the pending compression map to obtain a matching result specifically includes:
comparing each pixel point of the image to be compressed with the pixel point of the current compressed image;
when the undetermined compression diagram and the current compression diagram have different pixel points, determining that the matching result is matching failure;
and when all the pixel points of the to-be-determined compression diagram and the current compression diagram are the same, determining that the matching result is successful.
Preferably, the compression of the pixel points of the region to be drawn is calculated by the following formula,
Figure GDA0003981089770000021
wherein, (i, j) represents the pixel point of the ith row and the jth column of the area to be drawn, (x)Y) represents a pixel point in the compressed image corresponding to pixel point (i, j), (a) k ,b k ,c k ,d k ,e k ,f k ) The IFS code representing the original image to be rendered.
Preferably, after obtaining the IFS code based on the original image to be rendered to compress the current compression map and obtaining the image to be compressed, the method further includes:
comparing the pixel points of the image to be compressed with the pixel points of the current compressed image;
and when a target pixel point which does not belong to the current compression image exists in the image to be compressed, stopping drawing the fractal image.
Preferably, after the current compression map is compressed based on the IFS code of the original image to be rendered and a pending compression map is obtained, the method further includes:
acquiring each pixel point of the to-be-compressed graph, and judging whether the pixel point exceeding the to-be-drawn area exists in the to-be-compressed graph or not;
and when the pixel points exceeding the area to be drawn exist in the image to be compressed, stopping drawing the fractal image.
Preferably, after compressing the pixel points of the to-be-drawn region based on the IFS code of the original image to be drawn to obtain an initial compression map and using the initial compression map as the current compression map, the method further includes:
expressing the pixel points of the area to be drawn through a 0-1 matrix, wherein 1 in the 0-1 matrix expresses the pixel points forming the initial compression diagram, and 0 expresses the rest pixel points in the area to be drawn;
correspondingly, the compressing the current compression map based on the IFS code of the original map to be rendered to obtain the map to be compressed specifically includes:
and acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a to-be-determined compression diagram, and acquiring the to-be-determined matrix of the to-be-determined compression diagram based on the to-be-determined compression diagram.
Preferably, the matching the current compression map and the pending compression map to obtain a matching result specifically includes:
respectively acquiring a current matrix of the current compression diagram and an undetermined matrix of the undetermined compression diagram, and matching the current matrix with the undetermined matrix to obtain a matching result;
correspondingly, when the current matrix is completely the same as the undetermined matrix, the matching result is determined as successful matching;
and when the current matrix is different from the undetermined matrix, determining that the matching result is matching failure.
In addition, to achieve the above object, the present invention further provides an apparatus for implementing fractal drawing by compression, where the apparatus for implementing fractal drawing by compression includes: the fractal drawing method comprises the steps of storing a program for realizing fractal drawing by compression, storing the program on a memory, storing the program on the memory, and executing the program on the processor, wherein the program for realizing fractal drawing by compression is configured to realize the steps of the method for realizing fractal drawing by compression.
In addition, in order to achieve the above object, the present invention further provides a system for implementing fractal drawing through compression, where the system for implementing fractal drawing through compression includes:
and the IFS code acquisition module is used for acquiring the IFS code of the original image to be drawn.
And the current compression map acquisition module is used for compressing the pixel points of the area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression map, and the initial compression map is used as the current compression map.
And the undetermined compression image acquisition module is used for compressing the current compression image based on the IFS code of the original image to be drawn to obtain the undetermined compression image.
And the matching result acquisition module is used for matching the current compression diagram with the undetermined compression diagram to acquire a matching result.
And the matching failure processing module is used for taking the undetermined compression diagram as a current compression diagram when the matching result is that the matching is failed, and returning the IFS code based on the original diagram to be drawn to compress the current compression diagram to obtain the undetermined compression diagram.
And the matching success processing module is used for taking the undetermined compression image as a fractal image of the original image to be drawn when the matching result is that the matching is successful.
In addition, to achieve the above object, the present invention further provides a storage medium, on which a program for implementing fractal drawing through compression is stored, and when the program for implementing fractal drawing through compression is executed by a processor, the method for implementing fractal drawing through compression as described above is implemented.
The method comprises the steps of compressing pixel points of an area to be drawn based on IFS codes of an original picture to be drawn to obtain an initial compression picture, taking the initial compression picture as a current compression picture, compressing the current compression picture based on the IFS codes of the original picture to be drawn to obtain a to-be-compressed picture, matching the current compression picture with the to-be-compressed picture to obtain a matching result, taking the to-be-compressed picture as the current compression picture when the matching result is matching failure, returning the IFS codes of the original picture to be drawn to compress the current compression picture to obtain the to-be-compressed picture, and taking the to-be-compressed picture as a fractal picture of the original picture to be drawn when the matching result is matching success.
Drawings
Fig. 1 is a schematic structural diagram of a device for implementing fractal graph drawing through compression in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a first embodiment of a method for implementing fractal graph drawing through compression according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a method for fractal drawing through compression according to the present invention;
FIG. 4 is a schematic flow chart of a first embodiment of a system for fractal graph drawing by compression according to the present invention;
FIG. 5 is a schematic diagram of a region to be mapped according to the present invention;
FIG. 6 is a compression diagram of the IFS code in Table 1 for compressing the region to be mapped shown in FIG. 5 according to the present invention;
FIG. 7 is a compression diagram of the graph shown in FIG. 6 compressed by the IFS codes of Table 1 according to the present invention;
FIG. 8 is a compression diagram of the graph shown in FIG. 7 compressed by the IFS codes of Table 1 according to the present invention;
FIG. 9 is a compression diagram of the IFS code of Table 1 compressing the graph of FIG. 8 according to the present invention;
FIG. 10 is a compression diagram of the present invention obtained by compressing the graph shown in FIG. 9 by the IFS codes of Table 1;
FIG. 11 is a compression diagram of the graph shown in FIG. 10 compressed by the IFS codes of Table 1 according to the present invention;
FIG. 12 is a compression diagram of the present invention obtained by compressing the graph shown in FIG. 11 by the IFS codes of Table 1;
FIG. 13 is a compression diagram of the present invention obtained by compressing the graph of FIG. 12 by the IFS codes of Table 1;
fig. 14 is a square fractal diagram drawn by the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a device for implementing fractal graph drawing through compression in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the apparatus for implementing fractal drawing through compression may include: a processor 1001, e.g. a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the apparatus for implementing fractal drawing by compression and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a program for implementing fractal drawing through compression.
In the device for implementing fractal drawing by compression shown in fig. 1, the network interface 1004 is mainly used for data communication with an external network; the user interface 1003 is mainly used for receiving input instructions of a user; the device for realizing fractal graph drawing through compression calls a program for realizing fractal graph drawing through compression stored in the memory 1005 through the processor 1001, and executes the following operations:
acquiring an IFS code of an original image to be drawn;
compressing pixel points of an area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and taking the initial compression image as a current compression image;
compressing the current compression image based on the IFS code of the original image to be drawn to obtain a compression image to be drawn;
matching the current compression diagram with a to-be-determined compression diagram to obtain a matching result;
when the matching result is that the matching fails, taking the undetermined compression diagram as a current compression diagram, and returning the IFS code based on the original diagram to be drawn to compress the current compression diagram to obtain the undetermined compression diagram;
and when the matching result is that the matching is successful, taking the image to be compressed as a fractal image of the original image to be drawn.
Further, the processor 1001 may call a program stored in the memory 1005 to implement fractal graph drawing through compression, and further perform the following operations:
comparing each pixel point of the image to be compressed with the pixel point of the current compressed image;
when the undetermined compression diagram and the current compression diagram have different pixel points, determining the matching result as matching failure;
and when all the pixel points of the to-be-compressed graph and the current compressed graph are the same, determining that the matching result is successful.
Further, the processor 1001 may call a program stored in the memory 1005 to implement fractal drawing through compression, and further perform the following operations:
comparing the pixel points of the image to be compressed with the pixel points of the current compressed image;
and when target pixel points which do not belong to the current compression diagram exist in the to-be-compressed diagram, terminating the drawing of the fractal diagram.
Further, the processor 1001 may call a program stored in the memory 1005 to implement fractal drawing through compression, and further perform the following operations:
acquiring each pixel point of the to-be-compressed graph, and judging whether the pixel point exceeding the to-be-drawn area exists in the to-be-compressed graph or not;
and when the pixel points exceeding the area to be drawn exist in the image to be compressed, the drawing of the fractal image is stopped.
Further, the processor 1001 may call a program stored in the memory 1005 to implement fractal drawing through compression, and further perform the following operations:
and acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a to-be-determined compression diagram, and acquiring the to-be-determined matrix of the to-be-determined compression diagram based on the to-be-determined compression diagram.
Further, the processor 1001 may call a program stored in the memory 1005 to implement fractal drawing through compression, and further perform the following operations:
respectively acquiring a current matrix of the current compression diagram and an undetermined matrix of the undetermined compression diagram, and matching the current matrix with the undetermined matrix to obtain a matching result;
correspondingly, when the current matrix is completely the same as the undetermined matrix, the matching result is determined as successful matching;
and when the current matrix is different from the undetermined matrix, determining that the matching result is matching failure.
According to the scheme, the pixel points of the area to be drawn are compressed based on the IFS code of the original image to be drawn to obtain the initial compression image, the initial compression image is used as the current compression image, the current compression image is compressed based on the IFS code of the original image to be drawn to obtain the undetermined compression image, the current compression image is matched with the undetermined compression image to obtain the matching result, when the matching result is that the matching fails, the undetermined compression image is used as the current compression image, the IFS code based on the original image to be drawn is returned to compress the current compression image to obtain the undetermined compression image, and when the matching result is that the matching succeeds, the undetermined compression image is used as the fractal image to be drawn.
Based on the hardware structure, the embodiment of the method for realizing the fractal graph drawing through compression is provided.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a method for implementing fractal drawing through compression according to the present invention.
In a first embodiment, the method for implementing fractal graph drawing through compression includes the following steps:
s10: and acquiring the IFS code of the original image to be drawn.
Obtaining the IFS code of the original image to be rendered may be represented as (a) i ,b i ,c i ,d i ,e i ,f i ,i=1,2,3,∧,n)。
S20: and compressing pixel points of the area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and taking the initial compression image as the current compression image.
In this embodiment, the pixel points of the region to be drawn may be compressed by the following formula:
Figure GDA0003981089770000081
wherein, (i, j) represents the pixel point of the ith row and the jth column of the region to be drawn, (x, y) represents the pixel point corresponding to the pixel point (i, j) in the compressed graph, and (a) k ,b k ,c k ,d k ,e k ,f k ) The IFS code representing the original image to be rendered.
S30: and compressing the current compression diagram based on the IFS code of the original diagram to be drawn to obtain the image to be compressed.
It should be noted that theoretically, any fractal graph with IFS codes can be drawn by a compression method, but it is not easy to achieve this in practice, and the method provided by the present invention does not seek to draw any fractal graph with IFS codes by a compression method, but instead, realizes that part of the fractal graph is drawn by a compression method.
Therefore, after the to-be-compressed graph is obtained, all pixel points of the to-be-compressed graph need to be obtained, whether pixel points exceeding the to-be-drawn area exist in the to-be-compressed graph or not is judged, and when pixel points exceeding the to-be-drawn area exist in the to-be-compressed graph, the fact that the fractal graph cannot be drawn by the compression method provided by the invention means is judged, and the drawing of the fractal graph is stopped.
In addition, a plurality of compression graphs can be obtained by compressing the current compression graph based on the IFS code of the original graph to be drawn, but only when all the pixel points in the compression graph belong to the current compression graph, the fractal graph may be drawn in a compression mode, that is, the set formed by the pixel points of the obtained original graph to be drawn should be a subset of the set formed by the pixel points of the current compression graph.
In this embodiment, after the to-be-compressed graph is obtained, the pixel point of the to-be-compressed graph is compared with the pixel point of the current compressed graph, and when a target pixel point which does not belong to the current compressed graph exists in the to-be-compressed graph, the fractal graph is terminated.
S40: and matching the current compression diagram with the to-be-determined compression diagram to obtain a matching result.
In this embodiment, the matching between the current compression diagram and the pending compression diagram specifically means comparing each pixel point of the pending compression diagram with a pixel point of the current compression diagram, and when there is a different pixel point between the pending compression diagram and the current compression diagram, determining that the matching result is a matching failure.
And when all the pixel points of the to-be-compressed graph and the current compressed graph are the same, determining that the matching result is successful.
S50: and when the matching result is that the matching fails, taking the undetermined compression diagram as a current compression diagram, and returning the IFS code based on the original diagram to be drawn to compress the current compression diagram to obtain the undetermined compression diagram.
It can be understood that, when the matching fails, it is described that the currently obtained to-be-compressed graph is not a final compression result, and the currently obtained current compressed graph needs to be compressed based on the IFS code of the original graph to be drawn, so as to further obtain the to-be-compressed graph.
S60: and when the matching result is that the matching is successful, taking the image to be compressed as a fractal image of the original image to be drawn.
When the matching is successful, the pixel points of the currently obtained compression image are not changed any more, and the currently obtained compression image is a fractal image of the original image to be drawn.
In the embodiment, the pixel points of the area to be drawn are compressed based on the IFS code of the original image to be drawn to obtain an initial compression image, the initial compression image is used as the current compression image, the current compression image is compressed based on the IFS code of the original image to be drawn to obtain an undetermined compression image, the current compression image is matched with the undetermined compression image to obtain a matching result, when the matching result is that the matching fails, the undetermined compression image is used as the current compression image, the IFS code based on the original image to be drawn is returned to compress the current compression image to obtain the undetermined compression image, and when the matching result is that the matching succeeds, the undetermined compression image is used as the fractal image of the original image to be drawn.
Further, as shown in fig. 3, a second embodiment of the method for implementing fractal graph drawing by compression according to the present invention is proposed based on the first embodiment, and in this embodiment, after step S20, the method further includes:
s201: and expressing the pixel points of the area to be drawn by a 0-1 matrix, wherein 1 in the 0-1 matrix expresses the pixel points forming the initial compression diagram, and 0 expresses the rest pixel points in the area to be drawn.
It should be noted that, after compressing the pixel points in the region to be drawn to obtain the initial compression map, in order to store the pixel points of the initial compression map for facilitating subsequent comparison, the obtained pixel points of the initial compression map may be represented by a matrix, so that the pixel points included in the initial compression map are clearer.
In a specific implementation, the pixel points of the region to be plotted may be represented by a 0-1 matrix, where 1 represents the pixel points constituting the initial compression map, and 0 represents the remaining pixel points in the region to be plotted.
It is understood that, in the subsequent steps, each compression map obtained is stored and represented by a matrix, i.e., each compression map has a 0-1 matrix corresponding to the compression map.
Correspondingly, step S30 specifically includes:
s301: and acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a to-be-determined compression diagram, and acquiring the to-be-determined matrix of the to-be-determined compression diagram based on the to-be-determined compression diagram.
The current compression map comprises all the 1 pixels in the matrix corresponding to the current compression map, so that the compression of the current compression map is completed by compressing all the 1 pixels in the matrix.
It can be understood that, after each compression diagram is obtained, the compression diagram is stored and represented by a corresponding matrix, so that matching the current compression diagram with the pending compression diagram can be completed by obtaining the current matrix of the current compression diagram and the pending matrix of the pending compression diagram, matching the current matrix with the pending matrix, and obtaining a matching result.
In this embodiment, after each compression map is obtained, a matrix corresponding to the compression map is generated, and the compression map is stored and represented by the matrix, so that pixel points included in each compression map are clearer and clearer, and further, the subsequent matching work is simpler and easier.
Referring to fig. 4, fig. 4 is a functional block diagram of a first embodiment of a system for implementing fractal drawing through compression, and the first embodiment of the system for implementing fractal drawing through compression is provided based on a method for implementing fractal drawing through compression.
In this embodiment, the system for implementing fractal graph drawing through compression includes:
the IFS code acquiring module 10 is configured to acquire an IFS code of an original image to be rendered.
The IFS code of the original image to be rendered may be represented as (a) i ,b i ,c i ,d i ,e i ,f i ,i=1,2,3,∧,n)。
And the current compression map obtaining module 20 is configured to compress the pixel points in the area to be drawn based on the IFS code of the original image to be drawn, obtain an initial compression map, and use the initial compression map as the current compression map.
In this embodiment, the pixel points of the region to be drawn may be compressed by the following formula:
Figure GDA0003981089770000111
wherein, (i, j) represents the pixel point of the ith row and the jth column of the region to be drawn, (x, y) represents the pixel point corresponding to the pixel point (i, j) in the compressed graph, and (a) k ,b k ,c k ,d k ,e k ,f k ) The IFS code representing the original image to be rendered.
And the undetermined compression map obtaining module 30 is configured to compress the current compression map based on the IFS code of the original map to be drawn, so as to obtain an undetermined compression map.
It should be noted that theoretically, any fractal graph with IFS codes can be drawn by a compression method, but it is not easy to achieve this in practice, and the method provided by the present invention does not seek to draw any fractal graph with IFS codes by a compression method, but instead, realizes that part of the fractal graph is drawn by a compression method.
Therefore, after the undetermined compression diagram is obtained, all pixel points of the undetermined compression diagram need to be obtained, whether pixel points exceeding the area to be drawn exist in the undetermined compression diagram or not is judged, and when the pixel points exceeding the area to be drawn exist in the undetermined compression diagram, the fractal diagram cannot be drawn by the compression method provided by the invention, and the drawing of the fractal diagram is stopped.
In addition, a plurality of compression graphs can be obtained by compressing the current compression graph based on the IFS code of the original graph to be drawn, but only when all the points in the compression graph belong to the current compression graph, the fractal graph may be drawn in a compression mode, that is, the set formed by the obtained pixels of the original graph to be drawn should be a subset of the set formed by the pixels of the current compression graph.
In this embodiment, after the to-be-compressed graph is obtained, the pixel point of the to-be-compressed graph is compared with the pixel point of the current compressed graph, and when a target pixel point which does not belong to the current compressed graph exists in the to-be-compressed graph, the fractal graph is terminated.
And the matching result obtaining module 40 is configured to match the current compression map with the pending compression map to obtain a matching result.
In this embodiment, matching the current compression map with the to-be-compressed map specifically means comparing each pixel point of the to-be-compressed map with a pixel point of the current compression map, and determining that the matching result is a matching failure when the to-be-compressed map and the current compression map have different pixel points.
And when all the pixel points of the to-be-determined compression diagram and the current compression diagram are the same, determining that the matching result is successful.
And the matching failure processing module 50 is configured to, when the matching result is that matching fails, use the to-be-compressed graph as a current compression graph, and return to the step of compressing the current compression graph based on the IFS code of the original graph to be drawn to obtain the to-be-compressed graph.
It can be understood that, when the matching fails, it is described that the currently obtained to-be-compressed graph is not a final compression result, and the currently obtained current compressed graph needs to be compressed based on the IFS code of the original graph to be drawn, so as to further obtain the to-be-compressed graph.
And the matching success processing module 60 is configured to, when the matching result is that matching is successful, use the to-be-determined compression diagram as a fractal diagram of the original diagram to be drawn.
When the matching is successful, the pixel points of the currently obtained compression image are not changed any more, and the currently obtained compression image is a fractal image of the original image to be drawn.
In this embodiment, a pixel point of an area to be drawn is compressed based on an IFS code of an original image to be drawn to obtain an initial compression diagram, the initial compression diagram is used as a current compression diagram, the current compression diagram is compressed based on the IFS code of the original image to be drawn to obtain an undetermined compression diagram, the current compression diagram is matched with the undetermined compression diagram to obtain a matching result, when the matching result is a matching failure, the undetermined compression diagram is used as the current compression diagram, the IFS code based on the original image to be drawn is returned to compress the current compression diagram to obtain the undetermined compression diagram, and when the matching result is a matching success, the undetermined compression diagram is used as a fractal diagram of the original image to be drawn.
In addition, an embodiment of the present invention further provides a storage medium, where a program for implementing fractal drawing through compression is stored on the storage medium, and when executed by a processor, the program for implementing fractal drawing through compression implements the following operations:
acquiring an IFS code of an original image to be drawn;
compressing pixel points of an area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and taking the initial compression image as a current compression image;
compressing the current compression diagram based on the IFS code of the original diagram to be drawn to obtain a diagram to be compressed;
matching the current compression diagram with a to-be-determined compression diagram to obtain a matching result;
when the matching result is that the matching fails, taking the undetermined compression diagram as a current compression diagram, and returning the IFS code based on the original diagram to be drawn to compress the current compression diagram to obtain the undetermined compression diagram;
and when the matching result is that the matching is successful, taking the image to be compressed as a fractal image of the original image to be drawn.
Further, when executed by a processor, the program for implementing fractal graph drawing through compression further implements the following operations:
comparing each pixel point of the image to be compressed with the pixel point of the current compressed image;
when the undetermined compression diagram and the current compression diagram have different pixel points, determining that the matching result is matching failure;
and when all the pixel points of the to-be-compressed graph and the current compressed graph are the same, determining that the matching result is successful.
Further, when being executed by a processor, the program for implementing fractal graph drawing through compression further implements the following operations:
comparing the pixel points of the image to be compressed with the pixel points of the current compressed image;
and when target pixel points which do not belong to the current compression diagram exist in the to-be-compressed diagram, terminating the drawing of the fractal diagram.
Further, when being executed by a processor, the program for implementing fractal graph drawing through compression further implements the following operations:
acquiring each pixel point of the to-be-compressed graph, and judging whether the pixel point exceeding the to-be-drawn area exists in the to-be-compressed graph or not;
and when the pixel points exceeding the area to be drawn exist in the image to be compressed, stopping drawing the fractal image.
Further, when executed by a processor, the program for implementing fractal graph drawing through compression further implements the following operations:
and acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a to-be-determined compression diagram, and acquiring the to-be-determined matrix of the to-be-determined compression diagram based on the to-be-determined compression diagram.
Further, when executed by a processor, the program for implementing fractal graph drawing through compression further implements the following operations:
respectively acquiring a current matrix of the current compression diagram and an undetermined matrix of the undetermined compression diagram, and matching the current matrix with the undetermined matrix to obtain a matching result;
correspondingly, when the current matrix is completely the same as the undetermined matrix, the matching result is determined as successful matching;
and when the current matrix is different from the undetermined matrix, determining the matching result as matching failure.
According to the scheme, the pixel points of the area to be drawn are compressed based on the IFS code of the original image to be drawn to obtain the initial compression image, the initial compression image is used as the current compression image, the current compression image is compressed based on the IFS code of the original image to be drawn to obtain the undetermined compression image, the current compression image is matched with the undetermined compression image to obtain the matching result, when the matching result is that the matching fails, the undetermined compression image is used as the current compression image, the IFS code based on the original image to be drawn is returned to compress the current compression image to obtain the undetermined compression image, and when the matching result is that the matching succeeds, the undetermined compression image is used as the fractal image to be drawn.
In order to test the effect of the method provided by the invention in fractal drawing, a system for realizing fractal drawing through compression corresponding to the method is developed by VC + +, and the corresponding fractal drawing can be drawn through the system as long as the information of the IFS code is imported.
The test environment was as follows:
(1) Software development environment: indows 7, microsoft Visual Studio 2008; (2) software operating environment: windows 7; (3) hardware development environment: dell vostro 220PC.
Figure GDA0003981089770000151
Dual-Core CPU 2.70GHz,2GB DDR3 SDRAM memory, 320GB SATA (7200 RPM) hard disk; (4) hardware operating environment: dell vostro 220PC; (5) programming language and version number: microsoft Visual C + +2008.
When the IFS code information as described in table 1 is imported, the fractal graph shown in fig. 13 is obtained.
TABLE 1 iterative function System consisting of 5 functions
i a i b i c i d i e i f i p i
1 0.25 0 0 0.25 0 0 0.125
2 0.25 0 0 0.25 0.75 0 0.125
3 0.25 0 0 0.25 0 0.75 0.125
4 0.25 0 0 0.25 0.75 0.75 0.125
5 0.5 0 0 0.5 0.25 0.25 0.5
Fig. 6 to 13 are compression diagrams obtained by the first compression to the eighth compression, and it can be seen that, compared with the compression diagram obtained by the seventh compression, the pixel points of the compression diagram do not change any more, that is, the seventh compression diagram 12 is a fractal diagram of the original diagram to be drawn, and the whole compression drawing process can be clearly seen from fig. 6 to 12.
It should be noted that, of course, not all fractal graphs can be drawn by the method provided by the present invention, and when the fractal graphs cannot be drawn by the method provided by the present invention, the system will give a prompt, and the minimum compression times and drawing times required for drawing different fractal graphs are also different, for example, the fractal graph shown in drawing fig. 12 has the minimum compression time of 7 times, the minimum compression time of 134146.801028093 microseconds, and the fractal graph shown in drawing fig. 14 has the minimum compression time of 5 times, and the minimum compression time of 561484.777769989.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention or the portions contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A method for realizing fractal graph drawing through compression is characterized by comprising the following steps:
acquiring an IFS code of an original image to be drawn;
compressing pixel points of an area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and taking the initial compression image as a current compression image;
compressing the current compression diagram based on the IFS code of the original diagram to be drawn to obtain a diagram to be compressed;
matching the current compression diagram with a to-be-determined compression diagram to obtain a matching result;
when the matching result is that the matching fails, taking the undetermined compression diagram as a current compression diagram, and returning the IFS code based on the original diagram to be drawn to compress the current compression diagram to obtain the undetermined compression diagram;
when the matching result is that the matching is successful, taking the image to be compressed as a fractal image of the original image to be drawn;
compressing the pixel points of the area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and after the initial compression image is used as the current compression image, the method further comprises the following steps:
expressing the pixel points of the area to be drawn by a 0-1 matrix, wherein 1 in the 0-1 matrix expresses the pixel points forming the initial compression diagram, and 0 expresses the rest pixel points in the area to be drawn;
correspondingly, the compressing the current compression map based on the IFS code of the original image to be rendered to obtain the image to be compressed specifically includes:
acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a diagram to be compressed, and acquiring a matrix to be determined of the diagram to be compressed based on the diagram to be compressed;
the matching the current compression diagram with the pending compression diagram to obtain a matching result specifically includes:
respectively acquiring a current matrix of the current compression diagram and an undetermined matrix of the undetermined compression diagram, and matching the current matrix with the undetermined matrix to obtain a matching result;
correspondingly, when the current matrix is completely the same as the undetermined matrix, the matching result is determined as successful matching;
and when the current matrix is different from the undetermined matrix, determining the matching result as matching failure.
2. The method according to claim 1, wherein the matching the current compression map with the pending compression map to obtain a matching result specifically comprises:
comparing each pixel point of the image to be compressed with the pixel point of the current compressed image;
when the undetermined compression diagram and the current compression diagram have different pixel points, determining the matching result as matching failure;
and when all the pixel points of the to-be-compressed graph and the current compressed graph are the same, determining that the matching result is successful.
3. The method of claim 2, wherein the compression of the pixels of the region to be mapped is calculated by the formula,
Figure FDA0003981089760000021
wherein, (i, j) represents the pixel point of the ith row and the jth column of the area to be drawn, (x, y) represents the compression diagram(ii) a pixel in the shape corresponding to pixel (i, j), (a) k ,b k ,c k ,d k ,e k ,f k ) The IFS code representing the original image to be rendered.
4. The method of claim 3, wherein after obtaining the IFS code for compressing the current compression map based on the original image to be rendered, and obtaining the original image to be compressed, the method further comprises:
comparing the pixel points of the image to be compressed with the pixel points of the current compressed image;
and when target pixel points which do not belong to the current compression diagram exist in the to-be-compressed diagram, terminating the drawing of the fractal diagram.
5. The method of claim 4, wherein after compressing the current compression map based on the IFS codes of the original to be rendered and obtaining the to-be-compressed map, the method further comprises:
acquiring each pixel point of the to-be-compressed graph, and judging whether the pixel point exceeding the to-be-drawn area exists in the to-be-compressed graph or not;
and when the pixel points exceeding the area to be drawn exist in the image to be compressed, stopping drawing the fractal image.
6. An apparatus for implementing fractal graph drawing through compression, the apparatus for implementing fractal graph drawing through compression comprising: a memory, a processor and a program stored on the memory and executable on the processor for implementing fractal drawing by compression, the program for implementing fractal drawing by compression being configured to implement the steps of the method for implementing fractal drawing by compression as claimed in any one of claims 1 to 5.
7. A system for realizing fractal graph drawing through compression is characterized in that the system for realizing fractal graph drawing through compression comprises:
the IFS code acquisition module is used for acquiring an IFS code of the original image to be drawn;
the current compression image acquisition module is used for compressing pixel points of an area to be drawn based on the IFS code of the original image to be drawn to obtain an initial compression image, and the initial compression image is used as the current compression image;
the image to be compressed acquisition module is used for compressing the current compression image based on the IFS code of the original image to be drawn to acquire an image to be compressed;
the matching result acquisition module is used for matching the current compression diagram with the to-be-determined compression diagram to acquire a matching result;
a matching failure processing module, configured to, when the matching result is a matching failure, take the to-be-compressed graph as a current compressed graph, and return to the IFS code based on the original graph to be drawn to compress the current compressed graph, so as to obtain a to-be-compressed graph;
the matching success processing module is used for taking the to-be-determined compression image as a fractal image of the original image to be drawn when the matching result is that the matching is successful;
the current compression diagram obtaining module is further configured to represent the pixel points of the area to be drawn through a 0-1 matrix, where 1 in the 0-1 matrix represents the pixel points forming the initial compression diagram, and 0 represents the remaining pixel points in the area to be drawn; correspondingly, the compressing the current compression map based on the IFS code of the original image to be rendered to obtain the image to be compressed specifically includes: acquiring a current matrix corresponding to the current compression diagram, compressing all pixel points which are 1 in the current matrix based on the IFS code of the original diagram to be drawn to obtain a diagram to be compressed, and acquiring a matrix to be determined of the diagram to be compressed based on the diagram to be compressed;
the current compression diagram acquisition module is further configured to acquire a current matrix of the current compression diagram and an undetermined matrix of the undetermined compression diagram, match the current matrix with the undetermined matrix, and acquire a matching result; correspondingly, when the current matrix is completely the same as the undetermined matrix, the matching result is determined as successful matching; and when the current matrix is different from the undetermined matrix, determining the matching result as matching failure.
8. A storage medium, characterized in that the storage medium stores thereon a program for implementing fractal drawing by compression, and the program for implementing fractal drawing by compression implements the steps of the method for implementing fractal drawing by compression as claimed in any one of claims 1 to 5 when executed by a processor.
CN201810867276.8A 2018-08-01 2018-08-01 Method, device, system and storage medium for realizing fractal graph drawing through compression Active CN108961351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810867276.8A CN108961351B (en) 2018-08-01 2018-08-01 Method, device, system and storage medium for realizing fractal graph drawing through compression

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810867276.8A CN108961351B (en) 2018-08-01 2018-08-01 Method, device, system and storage medium for realizing fractal graph drawing through compression

Publications (2)

Publication Number Publication Date
CN108961351A CN108961351A (en) 2018-12-07
CN108961351B true CN108961351B (en) 2023-04-07

Family

ID=64466957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810867276.8A Active CN108961351B (en) 2018-08-01 2018-08-01 Method, device, system and storage medium for realizing fractal graph drawing through compression

Country Status (1)

Country Link
CN (1) CN108961351B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083794B (en) * 2019-04-29 2023-04-07 武汉轻工大学 Mode conversion method, device, storage medium and device for triple integral information

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4941193A (en) * 1987-10-02 1990-07-10 Iterated Systems, Inc. Methods and apparatus for image compression by iterated function system
CN104143022A (en) * 2014-07-25 2014-11-12 沈阳建筑大学 Hyperbolic grid art graph forming method
CN104572581A (en) * 2015-02-02 2015-04-29 沈阳建筑大学 Fractal method for nonlinear IFS (iterated function system) structure of complex analytic polynomial
CN106504296A (en) * 2016-11-09 2017-03-15 烟台中飞海装科技有限公司 A kind of Computer Fractal image generation method
CN107330959A (en) * 2017-06-26 2017-11-07 宁德师范学院 A kind of fractal pattern generation method and system based on HMM and rarefaction representation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4941193A (en) * 1987-10-02 1990-07-10 Iterated Systems, Inc. Methods and apparatus for image compression by iterated function system
CN104143022A (en) * 2014-07-25 2014-11-12 沈阳建筑大学 Hyperbolic grid art graph forming method
CN104572581A (en) * 2015-02-02 2015-04-29 沈阳建筑大学 Fractal method for nonlinear IFS (iterated function system) structure of complex analytic polynomial
CN106504296A (en) * 2016-11-09 2017-03-15 烟台中飞海装科技有限公司 A kind of Computer Fractal image generation method
CN107330959A (en) * 2017-06-26 2017-11-07 宁德师范学院 A kind of fractal pattern generation method and system based on HMM and rarefaction representation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王耀南.分形变换在图像压缩中的应用.《智能信息处理技术》.北京高等教育出版社,2003,第437-438页. *

Also Published As

Publication number Publication date
CN108961351A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108459964B (en) Test case selection method, device, equipment and computer readable storage medium
CN111444885B (en) Method and device for identifying components in image and computer readable storage medium
CN109688183B (en) Group control equipment identification method, device, equipment and computer readable storage medium
CN111414379A (en) Serial number generation method, device, equipment and computer readable storage medium
CN111652381A (en) Data set contribution degree evaluation method, device and equipment and readable storage medium
CN108197024B (en) Embedded browser debugging method, debugging terminal and computer readable storage medium
CN110990008B (en) Page updating method and device, storage medium and electronic equipment
CN108961351B (en) Method, device, system and storage medium for realizing fractal graph drawing through compression
CN110717158A (en) Information verification method, device, equipment and computer readable storage medium
CN111639523B (en) Target detection method, device, computer equipment and storage medium
CN112149570A (en) Multi-person living body detection method and device, electronic equipment and storage medium
CN111401465A (en) Training sample optimization method, device, equipment and storage medium
CN111061637A (en) Interface test method, interface test device and storage medium
CN111143001A (en) Language detection method of terminal, user equipment, storage medium and device
CN111090589A (en) Software testing method, software testing device and readable storage medium
CN110263110B (en) Geographic space data loading method and device based on rarefying algorithm and storage medium
CN110990732A (en) Loading method, device and equipment based on webpage and storage medium
CN108846883B (en) Quick drawing method and system for fractal graph, user equipment and storage medium
CN111078571B (en) Test method for analog response, terminal equipment and computer readable storage medium
CN112950167A (en) Design service matching method, device, equipment and storage medium
CN111090651A (en) Data source processing method, device and equipment and readable storage medium
CN113641767A (en) Entity relationship extraction method, device, equipment and storage medium
CN113032071A (en) Page element positioning method, page testing method, device, equipment and medium
CN108921917B (en) Adaptive fractal drawing method, device, system and storage medium
CN112417020A (en) Method and device for realizing service expansion, computer equipment and storage medium

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