Happy Shrimphttp://blog.csdn.net/lights_joy/Welcome reprint, but please keep the author informationThe geometric moment is theHuin the1962with translational, rotational, and scale invariance. OpenCVThe calculation of the moment is determined byC + +in theMomentsThis class comes complete with://! Raster image Momentsclass Cv_exports_w_map moments{public: //! The default constructor Moments (); //! The full constructor Moments (double m00, double M10, double m01, double M20, double M11
HTML5 Canvas transform is a matrix transformation, a kind of coordinate deformation.Three ways to deform coordinates, pan translate, scale scales, and rotate rotate can all be done by transform.Transform (M11, M12, M21, M22, DX, dy): This method must multiply the current transformation matrix by the following matrix:
M11
M21
Dx
M12
M22
Dy
0
described how auto_ptr and shared_ptr have shown this concept in heap-based resources. But not all resources are heap-based, and for that kind of resource, we need to build our own resource management classes. (stacks, which are automatically managed by the compiler, do not require manual control by the programmer; heap: Generation and release are controlled by programmers.) )
Problem arisesWe handle mutex objects of type mutex and use a class to manage it.void lock(Mutex* pm);void unlock(
;}Now the triangle out, but there is no border, this time only need to do two small triangles, one is the background color, one is the border color, and then use the positioning overlap together, remember their positioning to a pixel difference. As shown in the following:2. symbol character implementation is also to use two characters with absolute positioning to simulate, it can not simulate the triangle. Because it is a diamond, so it can only reveal half, the background and the background of
zoom in if the value is greater than 1.
Rotate (angle): rotate, angle is the rotation angle, unit is radian. If the value is greater than 0, it indicates clockwise rotation, and vice versa.
Effect:
2. Matrix Transformation
1: // obtain the canvas ID
2: var canvas = document.getElementById('canvas');
3: if (canvas == null)
4: {
5: return false;
6: }
7: // obtain the context
8: var context = canvas.getContext('2d');
9: // define the color
10:
. We want to create a square shape with border, with CSS3 Transfrom for 45 degrees of rotation.2.IE implementation-the CSS3 Transfrom compatibility scheme is implemented using the IE matrix filter.EXAMPLE
. Tips {
width:200px;
position:relative;
padding:10px;
Border:1pxsolid Blue;
Background-color:skyblue;
border-radius:5px;
}
. diamond{
-ms-filter: "Progid:DXImageTransform.Microsoft.Matrix (m11=0.7071067811865475, m12=-0.7071067
scale method accepts two parameters. X and y are the zooming factors of the horizontal and vertical axes respectively. They must both be positive values. If the value is smaller than 1.0, it means to zoom in. If the value is greater than 1.0, it means to zoom in. If the value is 1.0, there is no effect.Because the pixel size remains unchanged, the actual effect of this change is that there are more or less items to be painted in the canvas of the same size.The conversion example is as follows:F
scale method accepts two parameters. X and y are the zooming factors of the horizontal and vertical axes respectively. They must both be positive values. If the value is smaller than 1.0, it means to zoom in. If the value is greater than 1.0, it means to zoom in. If the value is 1.0, there is no effect.Because the pixel size remains unchanged, the actual effect of this change is that there are more or less items to be painted in the canvas of the same size.The conversion example is as follows:F
Because before there is a project demand is the time to update the UI countdown, before thought, this simple, with the timing or handler can be done, and performance is good, but the demand to the ListView, what,? A large number of view are required, that handle processing will hang Ah, What about the rotation? Too much memory and CPU, all of a sudden only thought of using handle to deal with, but the item too many how to manage it.? With such questions, thinking tangled, today inadvertently see
, both of which must be positive. The value is smaller than 1.0, which is larger than because the pixel size is constant, so the actual effect of this transformation is the same size of the canvas, can draw more or less things. Transformation example is as follows: Function Draw () { var ctx = document.getElementById (' Lesson01 '). GetContext (' 2d '); ctx.linewidth = 1.5; Ctx.fillrect (0,0,300,300); Ctx.translate (150,150);Ctx.rotate (MATH.PI/4);Ctx.scale (0.5,0.5);Ctx
objects. For example, when translating a point, it is to translate the coordinate system and then redraw the point.
Affine matrix:
M11 M12 0M21 m22 0DX dy 1DX and Dy control horizontal and vertical translationM11 and m22 control ScalingM12, m21 control rotation
If the coordinate of a vertex (x, y) transformed by the affine matrix is (x', y '),X' = M11 * x + m21 * Y + dxY' = m22 * Y + M12 * x + dy
Ii
Ie uses the filter only for rotate.
Suppose it corresponds to css3 rotate (30deg), then you only need to assign the following matrix value to the corresponding element of matrix filter and set sizingmethod = 'Auto expand:
Rad = 30 * Math. PI/180;
[
Cos rad,-Sin Rad
Sin rad, cos Rad
]
M11 M12 m21 m22 corresponds to the above four values
Filter: progid: DXImageTransform. Microsoft. Matrix (sizingmethod = "auto expand", M11 = 1,
transformations, including Translation, scaling, Flip, Rotation, and Shear ).This type of transformation can be represented by a 3 × 3 matrix, and the last row is (0, 0, 1 ). The transformation matrix converts the original coordinates (x, y) to the new coordinates (x ', y'). Here, the original coordinates and the new coordinates are regarded as the three-dimensional column vectors with the last line (1, the original column vector left multiplication transformation matrix obtains the new column
SelectQ1.productname, (Q2.m1 Power (2, orderdate) * salevolume as M1, (Q2.m2 Power (2, orderdate) * salevolume as m2, (Q2.m3 Power (2, orderdate) * salevolume as m3, (Q2.m4 Power (2, orderdate) * salevolume as M4, (Q2.m5 Power (2, orderdate) * salevolume as M5, (Q2.m6 Power (2, orderdate) * salevolume as M6, (Q2.m7 Power (2, orderdate) * salevolume as M7, (Q2.m8 Power (2, orderdate) * salevolume as M8, (Q2.m9 Power (2, orderdate) * salevolume as M9, (Q2.m10 Power (2, orderdate) * salev
); return d->state->worldMatrix * d->viewTransform();}Typical application: in the response to a mouse event, convert coordinates from physical coordinates to logical coordinates required by qpainterAffine Transformation and transmission TransformationQmatrix before qt4.3 (included) only supports affine transformation ).
Translation)
Scale)
Rotation)
Shear)
Qtransform supports perspective transformation ).
M11
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.