perspective

Perspective Transform + Crop in iOS with OpenCV

柔情痞子 提交于 2019-11-28 15:21:06
I'm trying to implement a cropping & perspective correction feature into an upcoming app. Whilst doing research, I came across: Executing cv::warpPerspective for a fake deskewing on a set of cv::Point http://sudokugrab.blogspot.ch/2009/07/how-does-it-all-work.html So I decided to try implementing this feature with OpenCV - the framework is there so the installation was fast. However, I'm not getting the results I hoped for: (2nd picture is the result) I've translated all the code to work with Xcode and triple checked the Coordinates. Can you tell me what is wrong with my code? For the sake of

gluPerspective parameters- what do they mean?

和自甴很熟 提交于 2019-11-28 15:18:15
问题 I wonder about the gluPerspective parameters. In all examples I see fovy is set to around 45-60degrees I've tried to set it to different values and the object just disappears what's the explanation for it? The aspect value should always be the ratio? why would one change it? zNear, zFar - once again the usual values are around 10 and 500+ what does it reflect? 回答1: The purpose of the 4 parameters is to define a view frustum , like this: where nothing outside of the frustum should be is

OpenGL sutherland-hodgman polygon clipping algorithm in homogeneous coordinates (4D, CCS)

百般思念 提交于 2019-11-28 10:24:51
问题 I have two questions. (I marked 1, 2 below) In OpenGl, the clipping is done by sutherland-hodgman. However, I wonder how to work sutherland-hodgman algorithm in homogeneous system (4D) I made a situation. In VCS, there is a line, R= (0, 3, -2, 1), S = (0, 0, 1, 1) (End points of the line) And a frustum is right = 1, left = -1, near = 1, far = 3, top = 4, bottom = -4 Therefore, the projection matrix P is 1 0 0 0 0 1/4 0 0 0 0 -2 -3 0 0 -1 0 If we calculate the line with the P, then the each

How do I compete the transformation matrix needed to transform a rectangle into a trapezium?

♀尐吖头ヾ 提交于 2019-11-28 05:05:06
问题 I'm playing around with css transforms and the equivalent filters in IE, and want to simulate perspective by transforming a 2d rectangle into a trapezium. Specifically, I want the right hand side of the rectangle to stay the same height, and the left hand side to be say 80% of the height, so that the mid points of both sides are horizontally in line with each other. I'm familiar with matrix algebra, but can't think how to determine what matrix will do that. 回答1: For projection, I'd use a 4x4

Perspective correction in OpenCV using python

被刻印的时光 ゝ 提交于 2019-11-28 04:35:32
I am trying to do a perspective correction of a tilted rectangle ( a credit card), which is tilted in all the 4 directions. I could find its four corners and the respective angles of its tilt but I cannot find the exact location of the coordinates, where it has to be projected. I am using cv2.getPerspectiveTransform to do the transformation. I have the aspect ratio of the actual card (the non tilted one), I want such coordinates such that the original aspect ratio is preserved. I have tried using a bounding rectangle but this increases the size of the card. Any help would be appreciated. Here

Perspective transform of SVG paths (four corner distort)

心已入冬 提交于 2019-11-28 04:09:31
How is it possible to distort paths in SVG in browser so that they are distorted to certain perspective using possibly javascript or css? The perspective distort can be made easily in Photoshop, Illustrator etc, but how about browsers? This is source path: And this is the path after transformation: This is my drag distort proposal ( share you knowledge, Q&A-style ). Live example is in http://jsfiddle.net/xjHUk/278/ and the main code is this: (only output window: http://jsfiddle.net/xjHUk/279/embedded/result/ ) function transferPoint (xI, yI, source, destination) { var ADDING = 0.001; // to

Can't get OpenCV's warpPerspective to work on Android

你。 提交于 2019-11-28 01:04:26
问题 I've been struggling to implement a quad to quad system in my Android application. The aim is to let the user take a picture, add 4 cornerpoints and have that quad extracted from the image as a rectangle. I had a look at this method and this question to use OpenCV for this. The resulting code is this: public static Bitmap warp(Bitmap image, MyPoint p1, MyPoint p2, MyPoint p3, MyPoint p4) { int resultWidth = 500; int resultHeight = 500; Mat inputMat = new Mat(image.getHeight(), image.getHeight

Can you do an isometric perspective with HTML5 <canvas>?

落爺英雄遲暮 提交于 2019-11-27 19:57:19
问题 It is possible to do an isometric perspective with HTML5 <canvas> ? It is with setTransform ? Or does it exist another way? Example: ctxt.setTransform (1, -0.2, 0, 1, 0, 0); Something like the perspective of Farmville. Thanks a lot. 回答1: You can draw whatever you want on the canvas down to the individual pixel, so any question like "is it possible" will have a "yes" answer. If you mean if a 3d pipeline is already built-in in the canvas the answer is no, canvas context is 2d so commands are 2d

Skewing an image using Perspective Transforms

谁说胖子不能爱 提交于 2019-11-27 18:25:50
I'm trying to perform a skew on an image, like one shown here (source: microsoft.com ) . I have an array of pixels representing my image and am unsure of what to do with them. Jacob A much better way to do this is by inverse mapping. Essentially, you want to "warp" the image, right? Which means every pixel in the source image goes to a predefined point - the predefinition is a transformation matrix which tells you how to rotate, scale, translate, shear, etc. the image which is essentially taking some coordinate (x,y) on your image and saying that, "Ok, the new position for this pixel is (f(x)

Calculating rectangle 3D coordinate with coordinate its shadow?

走远了吗. 提交于 2019-11-27 16:24:29
Sometimes was a problem what is the rectangle 3D rotated and be perspective transition (for example in CSS) draw as the tetragon. But we want obtain the rectangle (width, length, Euler angle, perspective) transformed via rotate and perspective draw as the tetragon. figure fig.1 points a,c diagonal rectangle(yellow) points A,C diagonal tetragon(shadow) (red) fig.2 a,b,c,d rectangle points(yellow) A,B,C,D shadow(tetragon) (red) Ivan.s Solve: Coordinate system: The origin of the coordinate system is coincident with diagonals intersection point. Axe Z normal to the tetragon. Axe X crosses point A