transformation

Python/OpenCV - Detect lines in a tennis court using two differents methods of Hough Line in OpenCV - Get differents results

有些话、适合烂在心里 提交于 2019-12-03 16:41:06
I'm trying to detect lines in a tennis court using openCV and hough transform. I would like to find horizontal and vertical lines in order to find intersection and finally detect the corner of the tennis court. Here the original image. But i have some problems. 1)I tried to use HoughLineP . Here the code : gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray,100,200,apertureSize = 3) lines = cv2.HoughLinesP(edges, 1, np.pi/2, 6, None, 50, 10); for line in lines[0]: pt1 = (line[0],line[1]) pt2 = (line[2],line[3]) cv2.line(img, pt1, pt2, (0,0,255), 2) cv2.imshow('dst',img) return res

Extrinsic Calibration With cv::SolvePnP

你说的曾经没有我的故事 提交于 2019-12-03 15:05:30
I'm currently trying to implement an alternate method to webcam-based AR using an external tracking system. I have everything in my environment configured save for the extrinsic calibration. I decided to use cv::solvePnP() as it supposedly does pretty much exactly I want, but after two weeks I am pulling my hair out trying to get it to work. A diagram below shows my configuration. c1 is my camera, c2 is the optical tracker I'm using, M is the tracked marker attached to the camera, and ch is the checkerboard. As it stands I pass in my image pixel coordinates acquired with cv:

Finding centre of rotation for a set of points [closed]

吃可爱长大的小学妹 提交于 2019-12-03 12:13:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . If I have an arbitrary set of points, and then the same set of points rotated by some degree, does anyone know of any algorithms to calculate/estimate where the centre of the rotation is? Or an area of study where these kinds of algorithms are needed? I am having trouble finding any relevant information. Thanks

QGraphicsView and QGraphicsItem: don´t scale item when scaling the view rect

一个人想着一个人 提交于 2019-12-03 09:37:18
问题 I am using Qt´s QGraphicsView - and QGraphicsItem -subclasses. is there a way to not scale the graphical representation of the item in the view when the view rectangle is changed, e.g. when zooming in. The default behavior is that my items scale in relation to my view rectangle. I would like to visualize 2d points which should be represented by a thin rectangle which should not scale when zooming in the view. See a typical 3d modelling software for reference where vertex points are always

UIView surface custom transformation/animation (like 'a water drop effect')

十年热恋 提交于 2019-12-03 08:56:40
What is the way to implement custom transformation (+ animation) on a view surface (similar to the images attached) ( not just the view bounds ). The question is mainly in what is the general way to do that (not exactly the 'water drop effect', but any examples would be appreciated for sure). I guess, that's some 'algorythmic' transformation of the layer layout 'grid', but not sure which way to 'dig' that in. (Another thought is that might be achieved with using some frameworks, however, I would still need to understand the core logic). UPDATE: Pretty good resource for animations lovers

Using estimateRigidTransform instead of findHomography

只愿长相守 提交于 2019-12-03 08:30:50
The example in the link below is using findHomography to get the transformation between two sets of points. I want to limit the degrees of freedom used in the transformation so want to replace findHomography with estimateRigidTransform . http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography Below I use estimateRigidTransform to get the transformation between the object and scene points. objPoints and scePoints are represented by vector <Point2f> . Mat H = estimateRigidTransform(objPoints, scePoints, false); Following the method used in

Simplify Couchdb JSON response

自古美人都是妖i 提交于 2019-12-03 06:50:25
问题 I'm storing location data in Couchdb, and am looking for a way to get an array of just the values, instead of key: value for every record. For example: The current response {"total rows": 250, "offset": 0, "rows":[ {"id": "ec5de6de2cf7bcac9a2a2a76de5738e4", "key": "user1", "value": {"city": "San Francisco", "address":"1001 Bayhill Dr"}, {"id": "ec5de6de2cf7bcac9a2a2a76de573ae4","key": "user1", "value": {"city": "Palo Alto", "address":"583 Waverley St"} ... (etc). ]} I only really need: [{

CGAffineTransform scale and translation - jump before animation

蹲街弑〆低调 提交于 2019-12-03 04:56:05
问题 I am struggling with an issue regarding CGAffineTransform scale and translation where when I set a transform in an animation block on a view that already has a transform the view jumps a bit before animating. Example: // somewhere in view did load or during initialization var view = UIView() view.frame = CGRectMake(0,0,100,100) var scale = CGAffineTransformMakeScale(0.8,0.8) var translation = CGAffineTransformMakeTranslation(100,100) var concat = CGAffineTransformConcat(translation, scale)

bounding box of numpy array

耗尽温柔 提交于 2019-12-03 04:16:01
问题 Suppose you have a 2D numpy array with some random values and surrounding zeros. Example "tilted rectangle": import numpy as np from skimage import transform img1 = np.zeros((100,100)) img1[25:75,25:75] = 1. img2 = transform.rotate(img1, 45) Now I want to find the smallest bounding rectangle for all the nonzero data. For example: a = np.where(img2 != 0) bbox = img2[np.min(a[0]):np.max(a[0])+1, np.min(a[1]):np.max(a[1])+1] What would be the fastest way to achieve this result? I am sure there

D3 Sankey chart using circle node instead of rectangle node

让人想犯罪 __ 提交于 2019-12-03 03:45:57
I want to use Sankey chart but with circle's instead of rectangles. I am following the example from Mike Bostock . I changed the code there to use circle by setting radius, but how to place the lines connecting nodes around circle. Any clue. Thanks. VividD first of all, I would like to tell you that I liked your idea. I will walk you through several simple steps needed to get a decent Sankey diagram with circles. The final result may not be ideal for your application, but I guess it may be useful for you as starting point. Once you get to know internal and external features of d3 Sankey plugin