transformation

opencv estimateRigidTransform: How to get global scale?

时光怂恿深爱的人放手 提交于 2019-11-29 02:44:42
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 more what I want to get, here is an example. Let's say estimateRigidTransform calculates a

Draw a line with a CALayer

柔情痞子 提交于 2019-11-29 01:33:56
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) * (pointA.y - pointB.y)); layer.frame = CGRectMake(0, 0, 1, length); //calculate and set the layer's center:

Pivot / Crosstab Query in Oracle 10g (Dynamic column number)

落爺英雄遲暮 提交于 2019-11-29 00:41:35
I have this table view UserName Product NumberPurchaces -------- ------- --------------- 'John Doe' 'Chair' 4 'John Doe' 'Table' 1 'Jane Doe' 'Table' 2 'Jane Doe' 'Bed' 1 How can I create a query that will provide this pivot view in Oracle 10g ? UserName Chair Table Bed -------- ----- ----- --- John Doe 4 1 0 Jane Doe 0 2 1 Any way to do it dynamically? I saw so many approaches (decode, PL/SQL loops, unions, 11g pivot) But I've yet to find something that will work for me based on the above example Edit : I don't know the number or type of products in development time so this has to be dynamic

Python/PIL affine transformation

别等时光非礼了梦想. 提交于 2019-11-28 23:31:14
This is a basic transform question in PIL. I've tried at least a couple of times in the past few years to implement this correctly and it seems there is something I don't quite get about Image.transform in PIL. I want to implement a similarity transformation (or an affine transformation) where I can clearly state the limits of the image. To make sure my approach works I implemented it in Matlab. The Matlab implementation is the following: im = imread('test.jpg'); y = size(im,1); x = size(im,2); angle = 45*3.14/180.0; xextremes = [rot_x(angle,0,0),rot_x(angle,0,y-1),rot_x(angle,x-1,0),rot_x

Android OpenCV getPerspectiveTransform and warpPerspective

我怕爱的太早我们不能终老 提交于 2019-11-28 22:01:05
I am a bit confused with the parameters of getPerspectiveTransform as I cannot see a proper image. Here is my code. The original_image variable is the image that contains a square object (and some others) that I want to crop and create a new image (something like this Android OpenCV Find Largest Square or Rectangle ). The variables p1, p2, p3, and p4 are the coordinates of the corners of the largest square/rectangle in the image. p1 is the upper left, p2 is the upper right, p3 is the lower right, and p4 is the lower left (clockwise assigning). Mat src = new Mat(4,1,CvType.CV_32FC2); src.put(

Understanding `scale` in R

一世执手 提交于 2019-11-28 16:36:39
问题 I'm trying to understand the definition of scale that R provides. I have data ( mydata ) that I want to make a heat map with, and there is a VERY strong positive skew. I've created a heatmap with a dendrogram for both scale(mydata) and log(my data) , and the dendrograms are different for both. Why? What does it mean to scale my data, versus log transform my data? And which would be more appropriate if I want to look at the dendrogram illustrating the relationship between the columns of my

Rotating a .NET panel in Windows Forms

ぐ巨炮叔叔 提交于 2019-11-28 14:42:06
We use Windows Forms and custom user controls, and I would like to be able to rotate the panel hosting the userControl in a particular form. I have seen similar functionnalities with WPF , but I can't use it for the moment. Is it possible to achieve the rotation of a panel and its children using possibly built-in .NET methods or GDI+ ? I have seen some pretty cool visual effect with menus that are displayed in game development, so I was wondering if it would be possible to create similar effects using Windows Forms. Brian Ensink Rotating a panel and its children in Windows Forms is not

Quaternion rotation without Euler angles

我的未来我决定 提交于 2019-11-28 13:51:55
In this comment it was strongly suggested that we should never use Euler angles. I understand that there are some limitation to Euler angles, most notably gimbal lock, but I'd like to know the best technique, or the set of techniques, that one typically uses in the absence of Euler angles? Most dicussions on this topic involve converting from an Euler angle to a quaternion and that is a simple thing to do. But the only way I have ever read about doing rotation without Euler angles at all is to create a quaternion from two vectors as described by the article "The Shortest Arc Quaternion" by

Velocity Template engine - key-value-map

南笙酒味 提交于 2019-11-28 13:25:49
I have some problems wo use a key-value-map into Velocity. Someone has an example of this functionality? $myMap ={} $myMap.put("mykey1", "myvalue") $myMap.delete("mykey1") $myMap.getValue("mykey1") As Nathan said, you should use: #set ($myMap = {}) to create a new map and assign it to a variable. Now, why is the put call printed. Anything that is not inside a directive, like #set(not printed) or #if(not printed) or #foreach(again not printed) , is printed, including free text, variables, and method calls . Velocity can't distinguish between $myMap.get('mykey') and $myMap.put('key', 'value') ,

iOS: Movie player view doesn't rotate

房东的猫 提交于 2019-11-28 11:42:50
I want to rotate my movie player view explicitly (not using Autorotation delegate) . I wrote following code for that and also put comments in it. The parent view of movie player does rotate but not movie player view itself. Could someone please assist me here what I am doing wrong? Thanks. #import "CustomMoviePlayer.h" #define degreesToRadian(x) (M_PI * (x) / 180.0) #define radianToDegrees(x) ((x) * 180.0/M_PI) @implementation CustomMoviePlayer @synthesize moviePlayer, myParentViewController; -(void)playMovie:(NSString*)filePath onViewController:(UIViewController*)controller { [