All Questions
Tagged with euclidean-distance c++
30
questions
11
votes
1
answer
3k
views
Example of increasing the work per thread in CUDA
Algorithm :
I'm writing a program with CUDA and the problem is the following:
Two matrices A (n * 128) and B (m * 128)
I take the first row of A, and I compute the distance between that vector and ...
5
votes
7
answers
419
views
Find a shortest distance between two buckets of numbers
I have two buckets (unordered, 1-dimentional data structures) of numbers and I want to calculate a minimal distance between any elements of the two buckets. Is there a way to find the shortest ...
4
votes
2
answers
4k
views
How to find the euclidian distance between the centroid of an object in one frame and the adjacent frame
We are doing a project in vehicle counting (using OpenCV). Now we have to find the euclidian distance from the centroid of the object in one frame to the adjacent frame? In our project we have done up ...
4
votes
1
answer
4k
views
Calculate squared Euclidean distance matrix on GPU
Let p be a matrix of first set of locations where each row gives the coordinates of a particular point. Similarly, let q be a matrix of second set of locations where each row gives the coordinates of ...
4
votes
1
answer
2k
views
Similarity Measurement between Color Image (OpenCV)
I'm working with a CBIR (Content-based Image Retrieval) project which will draw RGB histogram of images and also calculate the distance between other images with query image.
I'm using VS 2008 - MFC ...
3
votes
1
answer
7k
views
Calculate distance between two descriptors
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 ...
3
votes
1
answer
529
views
Binary Tree using int array as key (Euclidean distances)?
Have written a Binary Search Tree that stores data on ships, the key for the search is their acoustic signature.
When searching the tree I want to return either a ship with the correct signature or ...
2
votes
7
answers
5k
views
Pairwise Distance Calculation in c++
I'm computing the potential energy of a large (~1e5) number of particles in c++. In order to do this, I'm running a double loop in which I calculate pairwise distances, and from those distance compute ...
2
votes
2
answers
4k
views
How can I find the perpendicular distance between two parallel line segments?
I have many parallel line segments, for example L1(P1, P2) and L2(P3, P4).
The Points have each x and y coordinates.
These parallel line segments have varying angles between 0-180 degrees.
How can I ...
2
votes
1
answer
2k
views
Substitute function of bwdist in C++
I am implementing a code of Matlab in C++. In Matlab they have used bwdist to calculate the euclidean distance.
I am using the function distanceTransform to get the same result as in Matlab, but the ...
2
votes
1
answer
2k
views
Euclidean distance using intrinsic instruction
For a research project, I need to compute a lot of Euclidean distances, where certain dimensions must be selected and others discarded. In the current state of the program, the array of selected ...
2
votes
1
answer
2k
views
Distance between two cells in a 2D matrix
I have a 2D matrix represented as a vector of values, an index representing the first cell and a pair of coordinate representing the second cell.
vector<double> matrix;
auto index = 10;
auto ...
2
votes
3
answers
2k
views
minimum distance between 2 points in c++
I'm given m places (x,y coordinates).
I have n requests of finding the closest place to a given point P(x,y); (The minimum Euclidian distance)
How can i solve this problem below O(n*m) where n is ...
1
vote
2
answers
559
views
CLI/C++ How to store more than 15 digit float number?
For a school project, I have a simple program, which compares 20x20 photos. I put 20 photos, and then i put 21th photo, which is compared to existing 20, and pops up the answer, which photo i did ...
1
vote
1
answer
926
views
I just started to use Eigen Matrix algebra library and aim to create a similarity matrix of a dataset, suggestions?
I try to create a similarity matrix with eigen library on a dataset. I just read the csv file into eigen matrix but know as a matlab customer I am looking for something like bsxfun or something to ...
1
vote
2
answers
555
views
Optimal path from a list of points c++
i have this request:
i have a list of points and for each of these i have X, Y coordinate.
my goal is to find the optimal path between these points (I have to use all the points).
for example:
A (xa,...
1
vote
0
answers
125
views
caffe custom Euclidean layer
I need to do a rather simple thing using the caffe framework. I want to create a new custom c++ Euclidean layer. This layer should set all values of the bottom[1] BLOB (ground truth data) to the ...
1
vote
0
answers
222
views
calculating euclidean distance for Luv values between 2 pixels
In opencv c++ I'm trying to figure out how to calculate the euclidean distance between point i,j and all points within a 3x3 kernel. This is to create a contrast map of saliency from the Luv color ...
0
votes
1
answer
2k
views
How to find the distance(physical in m and pixels) between two object(points) in image in OpenCV and C+++?
Im using OpenCV and C++. I have already done the code where can find the center of the object. I also have the prior information about the distance between the camera and object(s) in the image.
I ...
0
votes
1
answer
684
views
Squared Euclidean distance with Row Major Matrix Eigen C++
Due to the fact that i plan to pass numpy arrays into my C++ code with pybind11, naturally i would like to compute with Row Major matrices. I found a (one liner) implementation of the squared ...
0
votes
1
answer
77
views
Raytracing Normalizing Screenspace
I normalized my screen coords in the range from -1 to +1. Then I trace some rays starting from those normalized coords and calc the signed distance field (sdf) with the origin and direction vectors.
...
0
votes
1
answer
522
views
Need help optimizing speed for a loop/dot-product function in C++ [closed]
I've identified a function in a tightloop that's responsible for 50% of the time in my program(finding nearest neighbors). It calculates the euclidean distance between two unit vectors. Is there any ...
0
votes
1
answer
121
views
How to speedup my Libsvm vector to std::vector<float> conversion?
Introduction
I have a libsvm vector of the form:
{i_1:v_1; i_2:v_2;...; i_n:v_n}
Where i_j:v_j represent respectively the index and the value. If the value is null then it wont be given any index.
...
0
votes
0
answers
60
views
Question about SURF descriptor euclid distance
I use c++ opencv(3.4.1) SURF(xfeatures2d) to get keypoints and descriptor.
Ptr<SURF> detector1 = SURF::create(800.0);
detector1->detect(img1, keypoints_1);
detector1->detect(img2, ...
0
votes
0
answers
575
views
How to implement custom loss function correctly in caffe?
I am beginer at caffe and I am implementing a custom loss function of caffe. But the error is occurred at runtest.
My loss function is similar with Euclidean loss. The original Euclidean loss ...
0
votes
1
answer
822
views
Calculating distance between SURF features in OpenCV
I want to be able to get a distance between SURF features in OpenCV. I'm using HDBSCAN to match multiple instance of an object in the image by clustering the features which requires calculating ...
0
votes
1
answer
1k
views
Euclidean distance between each record with other records in an array
so i have an array [nm] and i need to code in c++ the Euclidean distance between each row and the other rows in the array and store it in a new distance-array [nn] which every cell's value is the ...
0
votes
1
answer
3k
views
Detecting a black/blank frame in video using OpenCV
I'm using OpenCV 2.4.2 VideoCapture class to grab frames from multiple videos and my aim is to compare the frames between videos to retrieve similar videos (visually similar).
I'm facing two issues. ...
-1
votes
3
answers
2k
views
how to define a pow2 macro in C++
I want to have definition for pow2C as follows. But my compiler shows it (__tmpDouble__) is already defined. Please help me define it.
#ifndef pow2C
double __tmpDouble__;
#define pow2C(a) ((...
-1
votes
1
answer
6k
views
Euclidean distance between two arrays, undeclared identifier
I have this code in calculating euclidean distance. But, I don't know why I'm having this error. array1 and array2 undeclared .
double dist(double x[4] array1, double y[4] array2)
{
double Sum;
...