CN109886879B - Image processing method, electronic device and storage medium - Google Patents
Image processing method, electronic device and storage medium Download PDFInfo
- Publication number
- CN109886879B CN109886879B CN201910127902.4A CN201910127902A CN109886879B CN 109886879 B CN109886879 B CN 109886879B CN 201910127902 A CN201910127902 A CN 201910127902A CN 109886879 B CN109886879 B CN 109886879B
- Authority
- CN
- China
- Prior art keywords
- graph
- target point
- mirrored
- coordinate
- axis
- 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
Links
Images
Abstract
The invention discloses a graph mirror image processing method, which comprises the following steps: selecting a graph to be mirrored; receiving a graphic transformation parameter input by a user; acquiring the coordinate position of each target point in the graph to be mirrored according to the graph transformation parameters; acquiring a Y-axis symmetric graph of the graph to be mirrored according to the coordinate position of each target point; calculating the displacement required to move the identification target point in the Y-axis symmetric graph according to the graph change parameters and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain a coordinate point after the identification target point in the Y-axis symmetric graph moves; and moving the Y-axis symmetric graph according to the displacement required by the movement of the identification target point in the Y-axis symmetric graph. The invention establishes a coordinate system by obtaining the graph transformation parameters, obtains the coordinate values of all target points of the graph to be mirrored, can more quickly obtain the mirror image graph of the graph to be mirrored in the direction of the required mirror image, and moves the mirror image graph to the target position according to the displacement of the standard target point.
Description
Technical Field
The present invention relates to graphics processing technologies, and in particular, to a graphics mirror processing method, an electronic device, and a storage medium.
Background
At present, drawing software such as CAD and the like has a mirror image copying function, but is limited to mirror images which are symmetrical up and down and left and right, and mirror image operations at different angles and positions are needed, so that only manual drawing is realized. Inaccurate mirror image surface drawing can occur in the manual drawing process, and the workload is huge, so that the improvement of the working efficiency is not facilitated.
Disclosure of Invention
In order to overcome the defects of the prior art, one of the objectives of the present invention is to provide a method for processing a graphic mirror image, which can solve the problem that the prior art cannot perform multi-angle and multi-directional mirror image rendering.
The second objective of the present invention is to provide an electronic device, which can solve the problem that the prior art cannot perform multi-angle and multi-directional mirror image rendering.
The present invention is also directed to a storage medium, which can solve the problem that the prior art cannot perform multi-angle and multi-directional mirror image rendering.
One of the purposes of the invention is realized by adopting the following technical scheme:
the image processing method comprises the following steps:
a graph obtaining step: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained;
parameter setting step: receiving a graphic transformation parameter input by a user, wherein the graphic transformation parameter comprises a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
and (3) coordinate establishing: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
and (3) symmetrical mirror image step: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
and a displacement calculation step: calculating to obtain the displacement required to move by the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
a target translation step: and moving the Y-axis symmetric graph according to the displacement required to move the identification target point in the Y-axis symmetric graph so as to move the identification target point in the Y-axis symmetric graph to the coordinate point.
Preferably, the method further comprises the following steps:
and receiving a command of reserving or not reserving the graph to be mirrored by the user, and deleting the graph to be mirrored according to the command of not reserving the graph to be mirrored.
Preferably, in the pattern obtaining step, when the program formed between any two adjacent target points of the pattern to be mirrored is an arc, the arc corresponding to the arc between the two target points is also obtained.
The second purpose of the invention is realized by adopting the following technical scheme:
an electronic device comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, the computer program when executed by the processor implementing the steps of:
a graph obtaining step: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained;
a parameter setting step: receiving graphic transformation parameters input by a user, wherein the graphic transformation parameters comprise a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
a coordinate establishing step: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
and (3) symmetrical mirror image step: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
and a displacement calculation step: calculating to obtain the displacement required to move by the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
target translation: and moving the Y-axis symmetric graph according to the displacement required to move the identification target point in the Y-axis symmetric graph so as to move the identification target point in the Y-axis symmetric graph to the coordinate point.
Preferably, the computer program further performs the steps of:
and receiving a command of reserving or not reserving the graphics to be mirrored by the user, and deleting the graphics to be mirrored according to the command of not reserving the graphics to be mirrored.
Preferably, in the pattern obtaining step, when the program formed between any two adjacent target points of the pattern to be mirrored is an arc, the arc corresponding to the arc between the two target points is also obtained.
The third purpose of the invention is realized by adopting the following technical scheme:
a storage medium having stored thereon a computer program executable by a processor, the computer program, when executed by the processor, implementing a graphics image processing method according to one of the objects of the present invention.
Compared with the prior art, the invention has the beneficial effects that:
the invention establishes a coordinate system according to the graph transformation parameters by obtaining the graph transformation parameters and further obtains the coordinate values of all target points of the graph to be mirrored, thereby more rapidly obtaining the mirror image graph of the graph to be mirrored in the direction of the required mirror image and further translating the mirror image graph to the target position according to the displacement of the standard target point.
Drawings
FIG. 1 is a flowchart of a method for processing a graphic image according to the present invention.
Detailed Description
The invention will be further described with reference to the accompanying drawings and the detailed description below:
as shown in fig. 1, the present invention provides a method for processing a graphic mirror image, comprising the following steps:
s1: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained;
the software code of the provided flow steps can be loaded in CAD for operation, the graph is loaded when the software of CAD is drawn, and part or all of the graph is selected as the graph to be mirrored, wherein the graph to be mirrored is also called a source graph below. If the target point is a quadrilateral, the four intersections of the target point are the target points, which generally refer to the intersections of two lines.
S2: receiving a graphic transformation parameter input by a user, wherein the graphic transformation parameter comprises a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
and selecting a target point in the source image as an identification target point, so that the identification target point is preferentially used as a reference to move in the following operation, and other target points correspondingly move. The user inputs the graphic transformation parameters, clicks a point in the plane as the final position of the identification target point, clicks a point in the plane as the base point of the mirror image, the base point is between the final position of the identification target point and the current position of the identification target point, and the next mirror image transformation is performed with the base point as the center. And clicking one point in the plane to be marked as a second point, wherein the direction formed by the base point and the second point continuously is a mirror image direction. And according to the final position and the current position of the identification target point, the target point can be obtained
S3: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
s4: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
s5: calculating to obtain the displacement required to move by the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
s6: and moving the Y-axis symmetric graph according to the displacement required by the movement of the identification target point in the Y-axis symmetric graph, so that the identification target point in the Y-axis symmetric graph moves to the coordinate point, wherein the coordinate point is the final position.
Further, after performing S6, S7 may be further performed: and receiving a command of reserving or not reserving the graphics to be mirrored by the user, and deleting the graphics to be mirrored according to the command of not reserving the graphics to be mirrored.
In step S1, when the program formed between any two adjacent target points of the graph to be mirrored is an arc, the arc corresponding to the arc between the two target points is also acquired.
The invention also provides an electronic device comprising a processor, a memory and a computer program stored in the memory and executable by the processor, the computer program, when executed by the processor, implementing the steps of:
a graph obtaining step: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained; when the program formed between any two adjacent target points of the graph to be mirrored is an arc, the arc corresponding to the arc between the two target points is also acquired.
Parameter setting step: receiving a graphic transformation parameter input by a user, wherein the graphic transformation parameter comprises a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
a coordinate establishing step: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
and (3) symmetrical mirror image step: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
and a displacement calculation step: calculating the displacement required to move the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
a target translation step: and moving the Y-axis symmetric graph according to the displacement required by the movement of the identification target point in the Y-axis symmetric graph so as to enable the identification target point in the Y-axis symmetric graph to move to the coordinate point.
A step of reserving instructions: and receiving a command of reserving or not reserving the graphics to be mirrored by the user, and deleting the graphics to be mirrored according to the command of not reserving the graphics to be mirrored.
The present invention also provides a storage medium having a computer program stored thereon that is executable by a processor, the computer program implementing a graphics mirroring method according to any one of the present invention when executed by the processor.
Various other modifications and changes may be made by those skilled in the art based on the above-described technical solutions and concepts, and all such modifications and changes should fall within the scope of the claims of the present invention.
Claims (7)
1. The image processing method is characterized by comprising the following steps:
a graph obtaining step: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained;
a parameter setting step: receiving a graphic transformation parameter input by a user, wherein the graphic transformation parameter comprises a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
and (3) coordinate establishing: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
a symmetrical mirror image step: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
and a displacement calculation step: calculating the displacement required to move the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
target translation: and moving the Y-axis symmetric graph according to the displacement required to move the identification target point in the Y-axis symmetric graph so as to move the identification target point in the Y-axis symmetric graph to the coordinate point.
2. The graphic mirror processing method according to claim 1, further comprising the steps of:
and receiving a command of reserving or not reserving the graphics to be mirrored by the user, and deleting the graphics to be mirrored according to the command of not reserving the graphics to be mirrored.
3. The image mirroring processing method according to claim 1, wherein in the image acquisition step, when the program formed between any two adjacent target points of the image to be mirrored is an arc, an arc corresponding to the arc between the two target points is also acquired.
4. An electronic device comprising a processor, a memory and a computer program stored in the memory and executable by the processor, characterized in that the computer program realizes the following steps when executed by the processor:
a graph obtaining step: selecting a graph to be mirrored, wherein the graph to be mirrored is provided with a plurality of target points, one target point is selected as an identification target point, and the length of the side length between any two adjacent target points in the graph to be mirrored is obtained;
parameter setting step: receiving a graphic transformation parameter input by a user, wherein the graphic transformation parameter comprises a mirror image direction, a mirror image base point and a final position of an identification target point; calculating to obtain the displacement of the identified target point according to the final position of the identified target point;
and (3) coordinate establishing: taking the mirror image base point as a coordinate origin, establishing a Y axis parallel to the mirror image direction through the coordinate origin, establishing an X axis which passes through the coordinate origin and is perpendicular to the Y axis to form an XY coordinate system, and acquiring the coordinate position of each target point in the graph to be mirrored according to the XY coordinate system and the length of the side length between any two adjacent target points in the graph to be mirrored;
a symmetrical mirror image step: acquiring a Y-axis symmetric graph of the graph to be mirrored in a coordinate system by taking a Y axis as a symmetric axis according to the coordinate position of each target point;
and a displacement calculation step: calculating the displacement required to move the identification target point in the Y-axis symmetric graph according to the displacement of the identification target point, the coordinate position of the identification target point in the graph to be mirrored and the coordinate position of the identification target point in the Y-axis symmetric graph so as to obtain the coordinate point after the identification target point in the Y-axis symmetric graph moves;
target translation: and moving the Y-axis symmetric graph according to the displacement required to move the identification target point in the Y-axis symmetric graph so as to move the identification target point in the Y-axis symmetric graph to the coordinate point.
5. The electronic device of claim 4, wherein the computer program further performs the steps of:
and receiving a command of reserving or not reserving the graph to be mirrored by the user, and deleting the graph to be mirrored according to the command of not reserving the graph to be mirrored.
6. The electronic device according to claim 4, wherein in the pattern acquisition step, when the programming formed between any two adjacent target points of the pattern to be mirrored is an arc, an arc corresponding to the arc between the two target points is also acquired.
7. A storage medium having stored thereon a computer program executable by a processor, wherein the computer program, when executed by the processor, implements the graphics mirroring processing method according to any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910127902.4A CN109886879B (en) | 2019-02-19 | 2019-02-19 | Image processing method, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910127902.4A CN109886879B (en) | 2019-02-19 | 2019-02-19 | Image processing method, electronic device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109886879A CN109886879A (en) | 2019-06-14 |
CN109886879B true CN109886879B (en) | 2022-11-01 |
Family
ID=66928544
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910127902.4A Active CN109886879B (en) | 2019-02-19 | 2019-02-19 | Image processing method, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109886879B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112062458B (en) * | 2020-09-21 | 2023-03-17 | 四川南玻节能玻璃有限公司 | Mirror image cutting method for special-shaped glass |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080292215A1 (en) * | 2007-05-23 | 2008-11-27 | Xerox Corporation | Selective text flipping and image mirroring system and method |
CN104776832B (en) * | 2015-04-16 | 2017-02-22 | 浪潮软件集团有限公司 | Method, set top box and system for positioning objects in space |
EP3217355A1 (en) * | 2016-03-07 | 2017-09-13 | Lateral Reality Kft. | Methods and computer program products for calibrating stereo imaging systems by using a planar mirror |
-
2019
- 2019-02-19 CN CN201910127902.4A patent/CN109886879B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109886879A (en) | 2019-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20090160852A1 (en) | System and method for measuring a three-dimensional object | |
CN110285754B (en) | Workpiece positioning method, device and system based on laser scanning and storage medium | |
KR101670270B1 (en) | System and method for locating fiducials with known shape | |
CN113741426B (en) | Robot machining path planning method based on local point cloud curve fitting | |
CN105574931A (en) | Electronic map road drawing method and device | |
WO2018205493A1 (en) | Graphic drawing method, apparatus and device | |
CN106919009B (en) | Figure preprocess method before optical near-correction | |
CN106934842B (en) | Method and device for identifying closed area | |
WO2019167650A1 (en) | Method and device for generating tool paths | |
CN111753739B (en) | Object detection method, device, equipment and storage medium | |
CN109886879B (en) | Image processing method, electronic device and storage medium | |
US20190086199A1 (en) | On-line measuring system, datum calibrating method, deviation measuring method and computer-readable medium | |
CN116465602A (en) | Light spot quality detection method and device, electronic equipment and storage medium | |
US20220111515A1 (en) | Method and Apparatus for Managing Robot Program | |
CN115042184A (en) | Robot hand-eye coordinate conversion method and device, computer equipment and storage medium | |
CN111260723B (en) | Barycenter positioning method of bar and terminal equipment | |
CN110060330B (en) | Three-dimensional modeling method and device based on point cloud image and robot | |
CN116228850A (en) | Object posture estimation method, device, electronic equipment and readable storage medium | |
CN114594899A (en) | Map display adjusting method and device | |
Tiwan et al. | Cylindrical pellet pose estimation in clutter using a single robot mounted camera | |
CN109410304B (en) | Projection determination method, device and equipment | |
CN107633543B (en) | Line shape corresponding method considering local topological structure | |
CN113012281B (en) | Determination method and device for human body model, electronic equipment and storage medium | |
CN113158275B (en) | Method and system for modeling pinch-out sand body patterns | |
CN114820908B (en) | Virtual image generation method and device, electronic 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 | ||
CB02 | Change of applicant information |
Address after: 519000 201, Floor 2, Building 15, Science and Technology Innovation Park, No. 1 Harbour, Jintang Road, High tech Zone, Zhuhai, Guangdong Applicant after: Guangdong Jianxing Construction No.1 Engineering Co.,Ltd. Address before: 519085 201, Floor 2, Building 15, Science and Technology Innovation Park, No. 1 Harbour, Jintang Road, High tech Zone, Zhuhai City, Guangdong Province Applicant before: ZHUHAI ZHONGYIJIAN CONSTRUCTION ENGINEERING Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |