CN106447744A - Method for describing primitive coordinate transformation matrix by use of mirror images and rotation parameters of primitive - Google Patents
Method for describing primitive coordinate transformation matrix by use of mirror images and rotation parameters of primitive Download PDFInfo
- Publication number
- CN106447744A CN106447744A CN201610778931.3A CN201610778931A CN106447744A CN 106447744 A CN106447744 A CN 106447744A CN 201610778931 A CN201610778931 A CN 201610778931A CN 106447744 A CN106447744 A CN 106447744A
- Authority
- CN
- China
- Prior art keywords
- pel
- rotation
- primitive
- transformation matrix
- mirror image
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/60—Editing figures and text; Combining figures or text
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/32—Image data format
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Editing Of Facsimile Originals (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a method for describing a primitive coordinate transformation matrix by use of mirror images and rotation parameters of a primitive. The method comprises the following steps: step 1, additionally setting a variable m_bMirrorX used for recording a mirror image sign of the primitive in an x direction, a variable m_bMirrorY used for recording a mirror image sign of the primitive in a y direction, a variable m_direction used for recording the rotation direction of the primitive and a variable m_bClone used for recording whether the primitive is at a cloning state inside the primitive, and performing primitive initialization; step 2, performing mirror image operation on the primitive; and step 3, performing rotation operation on the primitive. Through the mode provdied by the invention, when a transposition matrix of the primitive is described by use of the three parameters, i.e., the mirror image sign of the primitive in the x direction, the mirror image sign of the primitive in the y direction and the rotation direction of the primitive, description is performed according to a fixed mode of "mirroring first and then rotation", and the three parameters are re-calculated each time the mirroring or the rotation is performed, such that the real state of the primitive can be accurately restored only by use of the three parameters, and mutual operation with figures of other manufacturers is conveniently carried out.
Description
Technical field
The present invention relates to mapping software field, more particularly, to a kind of image parameter with pel, rotation parameter are describing figure
The method of first transformation matrix of coordinates.
Background technology
In mapping software, mirror image operation, rotation process can be carried out to pel.General mapping software can use the seat of pel
Mark transformation matrix this is described because transformation matrix of coordinates is very convenient, can process various scalings, mirror image, rotation,
Translation, tilt situations such as and also support overlap-add operation.Inclination will not be used in general mapping software.Translation can be used
Recording, scaling can directly be recorded the coordinate of pel with zoom factor.When the rotation of pel be right angle rotation (i.e. 90 °,
180 °, 270 °, 360 °) when;What unique needs were paid close attention to is exactly mirror image, rotates the sequencing problem of this two parameters.Draw actual
When, drawing personnel are the dead ahead viewing figure in screen forever, at this moment pel are operated:After first mirror image, rotation is still first
Mirror image after rotation, the display effect that both operations order obtains is different.And the transformation matrix of coordinates record of pel
It is a section it is impossible to embody the sequencing of mirror image operation and rotation process.If we cannot determine this order, then
The image parameter that we obtain, rotation parameter are probably mistake.It would therefore be desirable to a kind of method, pel both can be recorded
Image parameter, rotation parameter, can correctly reduce mirror image, postrotational pel dispaly state again.
Content of the invention
For the problems referred to above, the present invention provides a kind of image parameter that both can record pel, rotation parameter, again can be just
Really reduction mirror image, the mirror image with pel of operation order of rotation, the method to describe pixel coordinates transformation matrix for the rotation parameter.
For solving the above problems, the technical scheme that the present invention provides is:With the mirror image of pel, rotation parameter, pel is described
The method of transformation matrix of coordinates, comprises the steps:With the mirror image of pel, rotation parameter, pixel coordinates transformation matrix is described
Method, comprises the steps:
Step one, set up inside pel for record pel x direction mirror flag variable m_bMirrorX, for
Record pel is in variable m_bMirrorY, the variable m_direction for recording pel direction of rotation of y direction mirror flag
And be used for recording whether pel is in the variable m_bClone of clone status and carries out pel initialization;
M_bMirrorX is simultaneously set to false by setting;M_bMirrorY is simultaneously set to false by setting, arranges and incites somebody to action
M_direction be set to 0, m_direction value be 0,1,2,3 represent respectively home position, turn clockwise 90 °,
Turn clockwise 180 °, turn clockwise 270 °;Setting m_bClone is simultaneously initialized with false;
Step 2, mirror image operation is carried out to pel, particularly may be divided into following steps:
A, the incoming two bool type numerical value of interface interchange person:X direction mirror flag bMx;Y direction mirror flag bMy;This two
Individual numerical value indicates whether specified pel will be carried out with x direction mirror image operation or y direction mirror image operation respectively;Definition be used for record x,
Two variable sx=1, sy=1 of the zoom factor in y direction;The temporary variable of transformation matrix of coordinates is deposited in definition:matrix;
B, judge whether pel is in clone status, be then execution c, otherwise execute d;
C, bMx, bMy are saved in the variable of pel, and change the zoom factor in x, y direction according to the value of bMx, bMy
sx、sy;Cover original pixel coordinates transformation matrix with the transformation matrix of coordinates newly obtaining, mirror image operation terminates;
D, first according to pel direction of rotation be whether 90 ° clockwise or clockwise 270 ° judge whether to need to exchange bMx,
The value of bMy;Value further according to new bMx, bMy is changed the value of m_bMirrorX, m_bMirrorY and is recalculated pel rotation
Direction m_direction;Then according to numerical value bMx, bMy that interface interchange person is incoming, the zoom factor sx in modification x, y direction,
sy;Cover original pixel coordinates transformation matrix with the transformation matrix of coordinates newly obtaining, mirror image operation terminates;
Step 3, rotation process is carried out to pel, particularly may be divided into following steps:
The incoming parameter of a, interface:Pel will be carried out with the direction direction of rotation process;Definition is used for recording x, y
Two temporary variables sx=1 of the zoom factor in direction, sy=1;Temporary variable matrix of transformation matrix of coordinates is deposited in definition;
B, the type according to rotation process, are added on m_direction, obtain new rotational direction value;Judge pel
Whether it is in clone status, be then to execute c, otherwise execute d;
C, direction is converted to the anglec of rotation and covers original pixel coordinates with the transformation matrix of coordinates that newly obtains
Transformation matrix, rotation process terminates;
D, change zoom factor sx, the sy in x, y direction according to the value of bMx, bMy;And recalculate pel direction of rotation, use
The transformation matrix of coordinates newly obtaining covers original pixel coordinates transformation matrix, and rotation process terminates.
The transformation matrix of coordinates of pel is exported as pel mirror flag, the anglec of rotation when, the meaning of parameters of derivation is
Pel wants first mirror image, rotates afterwards;The mirror flag of pel directly can derive without processing, the anglec of rotation=m_ of pel
direction*90.
When loading pel from graphic file, it is successively read in order from graphic file:m_bMirrorX、m_
bMirrorY、m_direction.
When preserving pel, m_bMirrorX, m_bMirrorY, m_direction are saved in graphic file successively.
By way of described in the invention, with pel in x direction mirror flag, pel in y direction mirror flag, pel
When these three parameters of direction of rotation describe the transposed matrix of pel, the mode according to rotation after fixing first mirror image is described,
And all recalculate these three parameters after each mirror image or rotation, thus only needing to three parameters just can be with accurate reproduction
The time of day of pel, the figure with other producers is easily interoperated.
Brief description
Fig. 1 is the initialized flow chart of pel in embodiment of the present invention.
Fig. 2 is the flow chart loading single pel in embodiment of the present invention from graphic file.
Fig. 3 is the flow chart preserving single pel in embodiment of the present invention to file.
Fig. 4 is the flow chart of pel mirror image operation functional interface in embodiment of the present invention.
Fig. 5 is the flow chart of pel rotation process functional interface in embodiment of the present invention.
Specific embodiment
The method describing pixel coordinates transformation matrix with the mirror image of pel, rotation parameter, comprises the steps:Step
First, set up variable in pel and carry out pel initialization, as shown in Figure 1;
Setting and is set in the bool type variable m_mirrorX of x direction mirror flag for recording pel
false;Setting in the bool type variable m_mirrorY of y direction mirror flag and is set to false for recording pel,
Setting is used for recording the integer type variable m_direction of pel direction of rotation and being set to 0, pel direction of rotation value
For 0,1,2,3 represent respectively home position, turn clockwise 90 °, turn clockwise 180 °, turn clockwise 270 °;Setting
It is used for recording whether pel is in the variable m_bClone of clone status and is initialized with false;
Step 2, will to pel in x direction mirror as operation flag bMx, pel in y direction mirror as the conduct of operation flag bMy
The mirror image operation interface of parameter call pel;Using pel direction of rotation direction as parameter call pel rotation process
Interface;
Step 3, mirror image operation is carried out to pel, particularly may be divided into following steps, as shown in Figure 4:
S1, pel mirror image operation functional interface start;
S2, the incoming two values of interface interchange person:X direction mirror flag:bMx;Y direction mirror flag:bMy;For table
The type of bright mirror image operation is x direction mirror picture or y direction mirror picture;
S3, definition are used for recording two temporary floating point number variable sx=1, sy=1 of the zoom factor in x, y direction;Definition
Deposit the temporary variable of transformation matrix of coordinates:matrix;
S4, judge whether pel is in clone status, be then execution S5, otherwise execute S12;
S5, numerical value incoming for interface interchange person is saved in the variable of pel:
M_mirrorX=bMx,
M_mirrorY=bMy;
S6, judge whether bMx is true, be then execution S7, otherwise execute S8;
S7, setting sx=-1;
S8, judge whether bMy is true, be then execution S9, otherwise execute S10;
S9, setting sy=-1;
S10, matrix.scale (sx, sy), cover the transformation matrix of coordinates of pel with matrix;
Turn S25;
If S12 m_direction is 1 or 3, exchange the value of bMx, bMy;Otherwise do not need to exchange;
S13, judge whether bMx is true, be then execution S13, otherwise execute S14;
S14, m_mirrorX negate;
If S15 m_direction is 1 or 3, execute S16, otherwise execute S17;
S16, m_direction=(m_direction+2) %4;
S17, judge bMy for true, be then execution S18, otherwise execute S19;
S18, m_mirrorY negate;
If S19 m_direction is 1 or 3, execute S20, otherwise execute S21;
S20, m_direction=(m_direction+2) %4;
S21, judge whether bMx is true, be then execution S23, otherwise execute S24;
S22, setting sx=-1;
S23, judge whether bMy is true, be then execution S25, otherwise execute S26;
S24, setting sy=-1;
S25、matrix.scale(sx,sy);
Angle=(m_direction*90) %360;
matrix.rotate(angle)
Cover the transformation matrix of coordinates of original pel with the transformation matrix of coordinates newly obtaining;
S26, pel mirror image operation functional interface terminate;
Step 4, rotation process is carried out to pel, particularly may be divided into following steps, as shown in Figure 5:
S1, pel rotation process functional interface start;
The incoming parameter of S2, interface:Pel will be carried out with the direction direction of rotation process;
S3, definition are used for recording two temporary variables sx=1 of the zoom factor in x, y direction, sy=1;Seat is deposited in definition
The temporary variable of mark transformation matrix:matrix;
S4, by incoming parameter to 4 deliverys, direction=direction%4;
S5, m_direction=(m_direction+direction) %4;According to the type of rotation process, it is added to
On the current m_direction of pel, obtain new m_direction value.
S6, judge whether pel is in clone status, be then execution S7, otherwise execute S10;
S7, the angle of the rotation of setting transformation matrix of coordinates matrix:Matrix.rotate (pel direction of rotation * 90);
S8, it is added on the transformation matrix of coordinates of pel with matrix, turn S17;
S10, judge whether m_mirrorX is true, be then execution S11, otherwise execute S13;
S11, setting sx=-1;
S12, m_direction=(m_direction+2) %4;
S13, judge whether m_mirrorY is true, be then execution S14, otherwise execute S16;
S14, setting sy=-1;
S15, m_direction=(m_direction+2) %4;According to the type of rotation process, the pel that is added to is current
M_direction on, obtain new m_direction value.
S16、matrix.scale(sx,sy);
Angle=(m_direction*90) %360;
matrix.rotate(angle)
Cover the transformation matrix of coordinates of original pel with the transformation matrix of coordinates newly obtaining;
S17, pel rotation process functional interface terminate.
When loading pel from graphic file, it is successively read in order from graphic file:m_bMirrorX、m_
bMirrorY、m_direction.
When preserving pel, m_bMirrorX, m_bMirrorY, m_direction are saved in graphic file successively.
Claims (3)
1. the method for pixel coordinates transformation matrix is described it is characterised in that including following walking with the mirror image of pel, rotation parameter
Suddenly:
Step one, set up inside pel for recording pel in the variable m_bMirrorX of x direction mirror flag, for recording
Pel y direction mirror flag variable m_bMirrorY, be used for record pel direction of rotation variable m_direction and
It is used for recording whether pel is in the variable m_bClone of clone status and carries out pel initialization;
Step 2, mirror image operation is carried out to pel, particularly may be divided into following steps:
A, the incoming two bool type numerical value of interface interchange person:X direction mirror flag bMx;Y direction mirror flag bMy;This two number
Value indicates whether specified pel will be carried out with x direction mirror image operation or y direction mirror image operation respectively;Definition is used for recording x, y side
To zoom factor two variable sx=1, sy=1;The temporary variable of transformation matrix of coordinates is deposited in definition:matrix;
B, judge whether pel is in clone status, be then execution c, otherwise execute d;
C, bMx, bMy are saved in the variable of pel, and according to the value of bMx, bMy change x, y direction zoom factor sx,
sy;Cover original pixel coordinates transformation matrix with the transformation matrix of coordinates newly obtaining, mirror image operation terminates;
D, it is whether 90 ° clockwise or 270 ° clockwise according to pel direction of rotation first and judges whether to need to exchange bMx, bMy
Value;Value further according to new bMx, bMy is changed the value of m_bMirrorX, m_bMirrorY and is recalculated pel direction of rotation
m_direction;Then according to numerical value bMx, bMy that interface interchange person is incoming, zoom factor sx, the sy in modification x, y direction;With
The transformation matrix of coordinates newly obtaining covers original pixel coordinates transformation matrix, and mirror image operation terminates;
Step 3, rotation process is carried out to pel, particularly may be divided into following steps:
The incoming parameter of a, interface:Pel will be carried out with the direction direction of rotation process;Definition is used for recording x, y direction
Zoom factor two temporary variables sx=1, sy=1;Temporary variable matrix of transformation matrix of coordinates is deposited in definition;
B, the type according to rotation process, are added on m_direction, obtain new rotational direction value;Whether judge pel
It is in clone status, be then to execute c, otherwise execute d;
C, direction is converted to the anglec of rotation and covers original pixel coordinates conversion with the transformation matrix of coordinates that newly obtains
Matrix, rotation process terminates;
D, change zoom factor sx, the sy in x, y direction according to the value of bMx, bMy;And recalculate pel direction of rotation, obtained with new
The transformation matrix of coordinates arriving covers original pixel coordinates transformation matrix, and rotation process terminates.
2. mirror image with pel according to claim 1, the method to describe pixel coordinates transformation matrix for the rotation parameter, its
It is characterised by:When loading pel from graphic file, it is successively read in order from graphic file:m_bMirrorX、m_
bMirrorY、m_direction.
3. mirror image with pel according to claim 1, the method to describe pixel coordinates transformation matrix for the rotation parameter, its
It is characterised by:When preserving pel, m_bMirrorX, m_bMirrorY, m_direction are saved in graphic file successively.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610778931.3A CN106447744B (en) | 2016-08-31 | 2016-08-31 | The method of pixel coordinates transformation matrix is described with the mirror image of pel, rotation parameter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610778931.3A CN106447744B (en) | 2016-08-31 | 2016-08-31 | The method of pixel coordinates transformation matrix is described with the mirror image of pel, rotation parameter |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106447744A true CN106447744A (en) | 2017-02-22 |
CN106447744B CN106447744B (en) | 2019-03-29 |
Family
ID=58091014
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610778931.3A Active CN106447744B (en) | 2016-08-31 | 2016-08-31 | The method of pixel coordinates transformation matrix is described with the mirror image of pel, rotation parameter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106447744B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109828818A (en) * | 2019-01-29 | 2019-05-31 | 广联达科技股份有限公司 | A kind of pel pattern transform method based on browser end display engine |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7554546B1 (en) * | 2003-12-18 | 2009-06-30 | Nvidia Corporation | Stippled lines using direct distance evaluation |
CN102799720A (en) * | 2012-07-03 | 2012-11-28 | 武汉天喻软件有限责任公司 | Computer-aided design (CAD) graph and image mixed editing system |
CN102902847A (en) * | 2012-09-17 | 2013-01-30 | 华北电力大学 | Transmission grid single line diagram automatic design method based on combination primitives |
CN104036059A (en) * | 2013-03-07 | 2014-09-10 | 纬衡浩建科技(深圳)有限公司 | Primitive-based engineering collaborative design method and system |
CN104778733A (en) * | 2015-04-20 | 2015-07-15 | 国家电网公司 | Webpage-based drawing and display method for power simulation diagram |
-
2016
- 2016-08-31 CN CN201610778931.3A patent/CN106447744B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7554546B1 (en) * | 2003-12-18 | 2009-06-30 | Nvidia Corporation | Stippled lines using direct distance evaluation |
CN102799720A (en) * | 2012-07-03 | 2012-11-28 | 武汉天喻软件有限责任公司 | Computer-aided design (CAD) graph and image mixed editing system |
CN102902847A (en) * | 2012-09-17 | 2013-01-30 | 华北电力大学 | Transmission grid single line diagram automatic design method based on combination primitives |
CN104036059A (en) * | 2013-03-07 | 2014-09-10 | 纬衡浩建科技(深圳)有限公司 | Primitive-based engineering collaborative design method and system |
CN104778733A (en) * | 2015-04-20 | 2015-07-15 | 国家电网公司 | Webpage-based drawing and display method for power simulation diagram |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109828818A (en) * | 2019-01-29 | 2019-05-31 | 广联达科技股份有限公司 | A kind of pel pattern transform method based on browser end display engine |
Also Published As
Publication number | Publication date |
---|---|
CN106447744B (en) | 2019-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11217019B2 (en) | Presenting image transition sequences between viewing locations | |
WO2021139408A1 (en) | Method and apparatus for displaying special effect, and storage medium and electronic device | |
WO2018176958A1 (en) | Adaptive mapping method and system depending on movement of key points in image | |
TWI647656B (en) | Method and device for mapping on spherical panoramic image | |
WO2015070668A1 (en) | Image processing method and apparatus | |
KR20120021149A (en) | Image correcting apparatus, correction image generating method, correction table generating apparatus, correction table generating method, computer readable recording medium storing a correction table generating program, computer readable recording medium storing a correction image generating program | |
JP2006012172A (en) | Method and apparatus for converting picture to caricature image | |
CN109416829A (en) | Parallel computer vision and image scaling framework | |
CN112288665A (en) | Image fusion method and device, storage medium and electronic equipment | |
WO2015072194A1 (en) | Display control device, display control method and program | |
CN106157241A (en) | A kind of method and device of Panorama Mosaic | |
CN111008927A (en) | Face replacement method, storage medium and terminal equipment | |
JP6336406B2 (en) | Image composition apparatus, image composition method, image composition program, and recording medium storing the program | |
TWI233304B (en) | Sprite recognition in animated sequences | |
CN105009172B (en) | For the method and apparatus that motion blur perceives vision posture tracking | |
WO2018025825A1 (en) | Image capture system | |
KR20230130748A (en) | Image processing methods and apparatus, devices and media | |
CN106447744A (en) | Method for describing primitive coordinate transformation matrix by use of mirror images and rotation parameters of primitive | |
WO2021008322A1 (en) | Image processing method, apparatus, and device | |
CN112819741A (en) | Image fusion method and device, electronic equipment and storage medium | |
CN105229706B (en) | Image processing apparatus, image processing method and program | |
US12094079B2 (en) | Reference-based super-resolution for image and video enhancement | |
US10553004B2 (en) | Method and apparatus for processing image and recording medium storing program therefor | |
CN111429549B (en) | Route image generation method, device and storage medium | |
US20220245783A1 (en) | Anti-Aliasing for Distance Field Graphics Rendering |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |