当前位置:网站首页>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;
}
边栏推荐
- 6.23星期四库作业
- 【实战项目】自主web服务器
- [set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)
- About debugging the assignment of pagenum and PageSize of the formal parameter pageweb < T > (i.e. page encapsulation generic) in the controller
- Why should we rewrite hashcode when we rewrite the equals method?
- @Autowired 导致空指针报错 解决方式
- BTC-密码学原理
- Maximum continuous sub segment sum (dynamic programming, recursive, recursive)
- Chapter II program design of circular structure
- Based on RFC 3986 (unified resource descriptor (URI): general syntax)
猜你喜欢

Basic knowledge of reflection (detailed explanation)

Brief introduction of realsense d435i imaging principle

Detailed explanation of the output end (head) of yolov5 | CSDN creation punch in

Altaro o365 total backup subscription plan

leetcode406. Rebuild the queue based on height

Promise

Use posture of sudo right raising vulnerability in actual combat (cve-2021-3156)

Principles of BTC cryptography

(完美解决)matplotlib图例(legend)如何自由设置其位置

BIO、NIO、AIO区别
随机推荐
Go language interface learning notes Continued
Congratulations to musk and NADELLA on their election as academicians of the American Academy of engineering, and Zhang Hongjiang and Fang daining on their election as foreign academicians
Chapter II program design of circular structure
Web APIs exclusivity
Class loading mechanism (detailed explanation of the whole process)
1099 build a binary search tree (30 points)
酒店公共广播背景音乐-基于互联网+的酒店IP网络广播系统设计
JS dynamic table creation
音频焦点系列:手写一个demo理解音频焦点与AudioMananger
Dynamic programming - related concepts, (tower problem)
Introduction to rust Foundation (basic type)
(subplots usage) Matplotlib how to draw multiple subgraphs (axis field)
Shallow and first code
leetcode406. Rebuild the queue based on height
Jetson AGX Orin 平台移植ar0233-gw5200-max9295相机驱动
乾元通多卡聚合路由器的技术解析
Covering Safari and edge, almost all mainstream browsers have realized webgl 2.0 support
Webrtc protocol introduction -- an article to understand ice, stun, NAT, turn
How do I migrate my altaro VM backup configuration to another machine?
Redis 入门和数据类型讲解