当前位置:网站首页>EMD distance - example of use
EMD distance - example of use
2022-07-03 05:20:00 【Dongli_】
Rubner Of C Language implementation
We try to use Rubner Open C The language code (example1.c),
Compile dependencies emd.c and emd.h.
Type of characteristic quantity feature_t stay emd.h Is defined as follows :
typedef struct { int X,Y,Z; } feature_t;
The specific implementation code is shown in emd.c.
The answer to the above example is as follows :
# include <stdio.h>
# include <math.h>
# include "emd.h"
/* Euclid distance */
float dist(feature_t *F1, feature_t *F2) {
int dX = F1->X - F2->X;
int dY = F1->Y - F2->Y;
int dZ = F1->Z - F2->Z;
return sqrt(dXdX + dY*dY + dZ*dZ);
}
int main() {
/* Distribution P The eigenvector of the */
feature_t f1[4] = {
{
100,40,22}, {
211,20,2}, {
32,190,150}, {
2,100,100} };
/* Distribution Q The eigenvector of the */
feature_t f2[3] = {
{
0,0,0}, {
50,100,80}, {
255,255,255} };
/* Distribution P The weight of */
float w1[5] = {
0.4, 0.3, 0.2, 0.1 };
/* Distribution Q The weight of */
float w2[3] = {
0.5, 0.3, 0.2 };
/* Distribution P The signature of the */
signature_t s1 = {
4, f1, w1 };
/* Distribution Q The signature of the */
signature_t s2 = {
3, f2, w2};
/* Calculation EMD */
float e;
e = emd(&s1, &s2, dist, 0, 0);
printf("emd = %f\n", e); return 0;
}
边栏推荐
- About debugging the assignment of pagenum and PageSize of the formal parameter pageweb < T > (i.e. page encapsulation generic) in the controller
- XML Configuration File
- appium1.22.x 版本後的 appium inspector 需單獨安裝
- Progressive multi grasp detection using grasp path for rgbd images
- 1094 the largest generation (25 points)
- Explanation of several points needing attention in final (tested by the author)
- 微服务常见面试题
- Why is go language particularly popular in China
- DEX net 2.0 for crawl detection
- Introduction to webrtc protocol -- an article to understand dtls, SRTP, srtcp
猜你喜欢
穀歌 | 蛋白序列的深度嵌入和比對
求质数的方法
BTC-密码学原理
Redis使用Lua脚本简介
XML配置文件
es7创建索引容易犯的错误
Pessimistic lock and optimistic lock of multithreading
"250000 a year is just the price of cabbage" has become a thing of the past. The annual salary of AI posts has decreased by 8.9%, and the latest salary report has been released
Introduction to deep learning (II) -- univariate linear regression
Gan network thought
随机推荐
AtCoder Beginner Contest 258(A-D)
BTC-密码学原理
Audio Focus Series: write a demo to understand audio focus and audiomananger
[basic grammar] Snake game written in C language
JS function algorithm interview case
How to connect the network: Chapter 1 CSDN creation punch in
Burp suite plug-in based on actual combat uses tips
Maximum continuous sub segment sum (dynamic programming, recursive, recursive)
Robot capture experiment demonstration video
How to install and configure altaro VM backup for VMware vSphere
leetcode406. Rebuild the queue based on height
Progressive multi grasp detection using grasp path for rgbd images
Celebrate the new year together
Shallow and first code
MySQL master-slave configuration
[basic grammar] C language uses for loop to print Pentagram
"Hands on deep learning" pytorch edition Chapter II exercise
酒店公共广播背景音乐-基于互联网+的酒店IP网络广播系统设计
Introduction to webrtc protocol -- an article to understand dtls, SRTP, srtcp
1094 the largest generation (25 points)