当前位置:网站首页>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;
}
边栏推荐
- 【批处理DOS-CMD命令-汇总和小结】-CMD窗口的设置与操作命令-关闭cmd窗口、退出cmd环境(exit、exit /b、goto :eof)
- About debugging the assignment of pagenum and PageSize of the formal parameter pageweb < T > (i.e. page encapsulation generic) in the controller
- 1095 cars on campus (30 points)
- Web APIs exclusivity
- Introduction to redis and explanation of data types
- Chapter II program design of circular structure
- Webrtc M96 release notes (SDP abolishes Plan B and supports opus red redundant coding)
- Redis使用Lua脚本简介
- "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
- Dynamic programming - related concepts, (tower problem)
猜你喜欢

Why is go language particularly popular in China

Primary school campus IP network broadcasting - Design of primary school IP digital broadcasting system based on campus LAN

Go practice -- gorilla / websocket used by gorilla web Toolkit

【实战项目】自主web服务器

Gbase8s composite index (I)

Yolov5 network structure + code + application details | CSDN creation punch in
![[set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)](/img/c2/87358af6b2b2892a6eceb751b3b60c.jpg)
[set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)

How to connect the network: Chapter 1 CSDN creation punch in

How to install and configure altaro VM backup for VMware vSphere

Differences among bio, NiO and AIO
随机推荐
[set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)
Pytorch through load_ state_ Dict load weight
Chapter II program design of circular structure
Yolov5 network structure + code + application details | CSDN creation punch in
Common interview questions of microservice
Go practice -- factory mode of design patterns in golang (simple factory, factory method, abstract factory)
Burp suite plug-in based on actual combat uses tips
Obtenir et surveiller les journaux du serveur distant
AtCoder Beginner Contest 258(A-D)
How to connect the network: Chapter 2 (Part 1): a life cycle of TCP connection | CSDN creation punch in
Botu uses peek and poke for IO mapping
study hard and make progress every day
(perfect solution) how to set the position of Matplotlib legend freely
Use posture of sudo right raising vulnerability in actual combat (cve-2021-3156)
Pessimistic lock and optimistic lock of multithreading
Common methods of JS array
Primary school campus IP network broadcasting - Design of primary school IP digital broadcasting system based on campus LAN
(subplots用法)matplotlib如何绘制多个子图(轴域)
Go practice -- generate and read QR codes in golang (skip2 / go QRcode and boombuilder / barcode)
Gbase8s composite index (I)