euclidean-distance

How to create a Large Distance Matrix?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 03:57:13
问题 How to allocate a huge distance matrix in an appropriate way to avoid " allocation is unable " error. Imagine you have a 100.000 points randomly spreaded over some space. How can one cleverly create a matrix or "dist"-object, which represents the the half of DistMatrix. Maybe it should be another object, which will be able efficiently allocate the large number of distances. You can get the polygonial object from the following link: https://www.dropbox.com/sh/65c3rke0gi4d8pb/LAKJWhwm-l # Load

How to create a Large Distance Matrix?

半世苍凉 提交于 2019-12-23 03:57:06
问题 How to allocate a huge distance matrix in an appropriate way to avoid " allocation is unable " error. Imagine you have a 100.000 points randomly spreaded over some space. How can one cleverly create a matrix or "dist"-object, which represents the the half of DistMatrix. Maybe it should be another object, which will be able efficiently allocate the large number of distances. You can get the polygonial object from the following link: https://www.dropbox.com/sh/65c3rke0gi4d8pb/LAKJWhwm-l # Load

Calculate the minimum distance between two given circular arcs

时光怂恿深爱的人放手 提交于 2019-12-23 02:46:33
问题 I'm trying to find a way to calculate the minimum distance between two given circular arcs. I found a solution in this link. It seems true but I don't know why that is correct!Can anyone prove it right? 回答1: The solution you refer to works because it is based on the properties of arks: An arc is a part of the circle Minimum distance is always reached either at the endpoints or at the perpendicular because it minimizes the distance (objective function). Think of two circles - minimal is always

How can I remove points from a list which are close to points in another list by some distance

痴心易碎 提交于 2019-12-23 02:18:49
问题 I have 2 lists of coordinates of points in an image. Say, List1 = [[2,3],[4,5],[10,20],[45,60]] List2 = [[100,50],[65,48],[58,32],[98,45]...............[655,254],[232,545]] dist = 20 List1 would have 5 or 6 elements. List2 could have more than 1000 elements. I want to generate a list3 in which I have only the coordinates from List2 whose euclidean distance from all the points in List1 is more than dist=20 . Basically my aim is to remove all points from List2 which are near to points in List1

How can I remove points from a list which are close to points in another list by some distance

余生长醉 提交于 2019-12-23 02:18:01
问题 I have 2 lists of coordinates of points in an image. Say, List1 = [[2,3],[4,5],[10,20],[45,60]] List2 = [[100,50],[65,48],[58,32],[98,45]...............[655,254],[232,545]] dist = 20 List1 would have 5 or 6 elements. List2 could have more than 1000 elements. I want to generate a list3 in which I have only the coordinates from List2 whose euclidean distance from all the points in List1 is more than dist=20 . Basically my aim is to remove all points from List2 which are near to points in List1

How to segment new data with existing K-means model?

大憨熊 提交于 2019-12-22 12:34:07
问题 I have built a segmentation model using k-means clustering. Could anybody describe the process for assigning new data into these segments? Currently I am applying the same transformations/standardisations/outliers as I did to build the model and then calculating the euclidean distance. The minimum distance is the segment that record falls into. But, I am seeing the majority fall into 1 particular segment and I am wondering if I have missed something along the way? Thanks 回答1: Classifying a

Calculating a Voronoi diagram for planes in 3D

给你一囗甜甜゛ 提交于 2019-12-22 10:53:52
问题 Is there a code/library that can calculate a Voronoi diagram for planes (parallelograms) in 3D? I checked Qhull and it seems it can only work with points, in its examples Voro++ works with different size of spheres but I couldn't find anything for polygons. In this image (sample planes in 3d) the parallelograms are 3D since they have a thickness, but in this case the thickness will be zero.! 回答1: Voronoi cells are not parallelograms. You are confused here by the image you posted. Voronoi cell

Distance matrix from two separate data frames

早过忘川 提交于 2019-12-22 09:10:13
问题 I'd like to create a matrix which contains the euclidean distances of the rows from one data frame versus the rows from another. For example, say I have the following data frames: a <- c(1,2,3,4,5) b <- c(5,4,3,2,1) c <- c(5,4,1,2,3) df1 <- data.frame(a,b,c) a2 <- c(2,7,1,2,3) b2 <- c(7,6,5,4,3) c2 <- c(1,2,3,4,5) df2 <- data.frame(a2,b2,c2) I would like to create a matrix with the distances of each row in df1 versus the rows of df2. So matrix[2,1] should be the euclidean distance between df1

Numpy: find the euclidean distance between two 3-D arrays

北战南征 提交于 2019-12-22 08:47:07
问题 Given, two 3-D arrays of dimensions (2,2,2): A = [[[ 0, 0], [92, 92]], [[ 0, 92], [ 0, 92]]] B = [[[ 0, 0], [92, 0]], [[ 0, 92], [92, 92]]] How do you find the Euclidean distance for each vector in A and B efficiently? I have tried for-loops but these are slow, and I'm working with 3-D arrays in the order of (>>2, >>2, 2). Ultimately I want a matrix of the form: C = [[d1, d2], [d3, d4]] Edit: I've tried the following loop, but the biggest issue with it is that loses the dimensions I want to

Calculate distance between two descriptors

主宰稳场 提交于 2019-12-22 01:20:47
问题 I'm trying to calculate the distance (Euclidean or hamming) between two descriptors already calculated. The problem is I don't want to use a matcher, I just want to calculate the distance between two descriptors. I'm using OpenCV 2.4.9 and i have mine descriptors stored in a Mat type: Mat descriptors1; Mat descriptors2; and now i just want to calculate the distance (preferably the Hamming distance since I'm using binary descriptors) between row1 of descriptors1 and row1 of descriptors2 (for