transformation

opencv estimateRigidTransform: How to get global scale?

大城市里の小女人 提交于 2020-01-09 23:53:12
问题 I'm using openCV's estimateRigidTransform to stabilize a series of video frames, which works very well. The function returns a 2x3 transformation matrix M: | a_11 a_12 b_1 | | -a_12 a_11 b_2 | As far as I understand the b elements represent the translation, and the a elements are used to do the scaling and rotation. What I would like to do, is get global scale from M - a value that represents the camera zooming factor. How can I do calculate this correctly from a values? To clarify a little

Draw a line with a CALayer

こ雲淡風輕ζ 提交于 2020-01-09 19:31:07
问题 I'm trying to draw a line between two points using a CALayer. Here is my code: //positions a CALayer to be a line between a parent node and its subnodes. -(void)makeLineLayer:(CALayer *)layer lineFromPointA:(CGPoint)pointA toPointB:(CGPoint)pointB{ NSLog([NSString stringWithFormat:@"Coordinates: \n Ax: %f Ay: %f Bx: %f By: %f", pointA.x,pointA.y,pointB.x,pointB.y]); //find the length of the line: CGFloat length = sqrt((pointA.x - pointB.x) * (pointA.x - pointB.x) + (pointA.y - pointB.y) *

Draw a line with a CALayer

♀尐吖头ヾ 提交于 2020-01-09 19:27:07
问题 I'm trying to draw a line between two points using a CALayer. Here is my code: //positions a CALayer to be a line between a parent node and its subnodes. -(void)makeLineLayer:(CALayer *)layer lineFromPointA:(CGPoint)pointA toPointB:(CGPoint)pointB{ NSLog([NSString stringWithFormat:@"Coordinates: \n Ax: %f Ay: %f Bx: %f By: %f", pointA.x,pointA.y,pointB.x,pointB.y]); //find the length of the line: CGFloat length = sqrt((pointA.x - pointB.x) * (pointA.x - pointB.x) + (pointA.y - pointB.y) *

Transform one column from categoric to binary, keep the rest [duplicate]

纵然是瞬间 提交于 2020-01-09 11:45:11
问题 This question already has answers here : Generate a dummy-variable (16 answers) Closed 2 years ago . I have a medium large dataframe, for which I want to transform one column with categories to binary columns, one for each category. At the same time, I want to keep the rest of the columns in the dataframe. What would be the easiest way to achieve this? Here is an example of what I want to do: d<-data.frame(ID=c("a","b","c","d"), Gender=c("male", "male", "female","female"), Age =c(23,45,18,11)

Understanding the ModelView Matrix

天涯浪子 提交于 2020-01-07 03:45:07
问题 I want to analyze the each component of my 4*4 ModelView Matrix. I came to know that the starting 3*3 of ModelView Matrix stores rotation. If i want my object to have no rotation with respect to camer a so My ModelView Matrix looks like this How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this. 回答1: The upper left 3×3 defines the base vectors of a coordinate system. It's not just rotation but also scaling, shearing and

translate coordinates relative to line segment

送分小仙女□ 提交于 2020-01-07 03:22:30
问题 I need to write a function (in Javascript) that accepts the endpoints of a line segment and an additional point and returns coordinates for the point relative to the start point. So, based on this picture: function perpendicular_coords(x1,y1, x2,y2, xp,yp) returns [xp',yp'] where xp' is the distance from (xp,yp) along a line perpendicular to the line segment, and yp' is the distance from (x1,y1) to the point where that perpendicular line intersects the line segment. What I've tried so far:

locating a point in a 2d image that was warped

依然范特西╮ 提交于 2020-01-07 00:58:28
问题 I have an original image that has been "warped". Can someone help me with the math to calculate where a given point from the original image would show up in the warped one? I have an image with a rectangle inside of it. I know where, in the flat image the points A, B, C, D, E and F are. +------------------------------------------------+ | | | A B | | +-------------------+ | | | | | | | •F | | | | | | | | | | | | | | | | •E | | | +-------------------+ | | C D | | | +---------------------------

Concatenate data into one variable

霸气de小男生 提交于 2020-01-06 13:10:12
问题 An XML file has data like: <AddtlStsRsnInf>/00000002/Level 2 Reject</AddtlStsRsnInf> <AddtlStsRsnInf>The Transaction Reference Number is</AddtlStsRsnInf> <AddtlStsRsnInf>not unique.</AddtlStsRsnInf> How do you concatenate the data from all the three tags into a variable? Thanks and regards, Kiran 回答1: This may help: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="concat" match="/data"> <xsl:for

Concatenate data into one variable

隐身守侯 提交于 2020-01-06 13:09:52
问题 An XML file has data like: <AddtlStsRsnInf>/00000002/Level 2 Reject</AddtlStsRsnInf> <AddtlStsRsnInf>The Transaction Reference Number is</AddtlStsRsnInf> <AddtlStsRsnInf>not unique.</AddtlStsRsnInf> How do you concatenate the data from all the three tags into a variable? Thanks and regards, Kiran 回答1: This may help: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="concat" match="/data"> <xsl:for

.jar to .cs class/file transform technique or utility?

Deadly 提交于 2020-01-06 06:09:43
问题 I am looking for a way to transform some classes from Java to .Net in a code gen way. Not at run time, but re-generate a handful of business objects as needed (not often). the catch is, i want to have full control of how they end up. So while java classes have get and set methods, i will create a property out of them. the only way i can think of for now, is to read the file using c#, get the necessary members, and maybe feed them to a code gen template. at the very lease, i could throw them