📄 pdfcolor_ellipserand.c
字号:
#include <math.h>
#include "mex.h"
#include <time.h>
/*
Usage
-----
[py , zi , yi] = pdfcolor_ellipserand(Z , y , e , Npdf , vect_edge1 , vect_edge2 , vect_edge3 );%
Inputs
------
Z Image (m x n x 3)
y State position (2 x N)
e Ellipsoid (3 x N)
Npdf Number of samples to copute the color histogram
vect_edge1 Color support (R or H) (1 x Nx)
vect_edge2 Color support (G or S) (1 x Ny)
vect_edge3 Color support (B or V) (1 x Nz)
Ouputs
-------
py pdf color (NxNyNz x N)
zi Interpolated color values (3 x Npf x N)
yi Position of Interpolated values (2 x Npf x N)
To compile
-----------
mex -output pdfcolor_ellipserand.dll pdfcolor_ellipserand.c
mex -f mexopts_intel10amd.bat -output pdfcolor_ellipserand.dll pdfcolor_ellipserand.c
Example 1
Z = rand(200 , 200 , 3);
y = [111 , 52 , 15 , 56 ; 22 , 100 , 34 , 43];
e = [10 , 10 , 10 , 30 ; 15, 3 , 22 , 10 ; -pi/1.1 , pi/2 , 0 ,0.75*pi];
Npdf = 4000;
Nx = 4;
Ny = 3;
Nz = 5;
M = Nx*Ny*Nz;
vect_edge1 = (0 : 1/Nx : 1);
vect_edge2 = (0 : 1/Ny : 1);
vect_edge3 = (0 : 1/Nz : 1);
[py , zi , yi] = pdfcolor_ellipserand(Z , y , e , Npdf , vect_edge1 , vect_edge2 , vect_edge3 );%
figure(1)
imagesc(Z);
hold on
plot(squeeze(yi(1 , : , :)) , squeeze(yi(2 , : , :)) , '+')
axis ij
axis equal
hold off
figure(2)
plot((1:M) , py);
axis([1 , M , 0 , 0.12])
Author : S閎astien PARIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -