All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
user avatar
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 ...
oleksii's user avatar
  • 35.7k
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 ...
user1244643's user avatar
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 ...
Alexey's user avatar
  • 5,938
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 ...
iry's user avatar
  • 41
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 ...
zedv's user avatar
  • 1,459
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 ...
lex's user avatar
  • 174
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 ...
astromax's user avatar
  • 6,071
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 ...
baal's user avatar
  • 257
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 ...
hawkeye's user avatar
  • 349
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 ...
Deadloop's user avatar
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 ...
Nick's user avatar
  • 10.4k
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 ...
Dan Dinu's user avatar
  • 33k
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 ...
Kedor's user avatar
  • 1,488
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 ...
erogol's user avatar
  • 13.4k
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,...
Safari's user avatar
  • 11.7k
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 ...
divined's user avatar
  • 33
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 ...
Zypps987's user avatar
  • 404
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 ...
bob's user avatar
  • 369
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 ...
lefe's user avatar
  • 157
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. ...
Michael's user avatar
  • 327
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 ...
ijklr's user avatar
  • 147
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. ...
Hani Goc's user avatar
  • 2,431
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, ...
SongDoHou's user avatar
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 ...
Masahiro's user avatar
  • 175
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 ...
Onalenna Junior Makhura's user avatar
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 ...
Star Ali's user avatar
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. ...
Uni's user avatar
  • 45
-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) ((...
remo's user avatar
  • 888
-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; ...
pingboo23's user avatar
  • 137