calculating an expression in an efficient way

1 回表示 (過去 30 日間)
Sukuchha
Sukuchha 2012 年 10 月 16 日
I have binary image size mxn with K number of 1's at different location (Xk,Yk). Now i want to produce a spatial voting image such that each point (1's) has the highest vote at its spatial coordinate (Xk, Yk), and its votes decrease with respect to the spatial distance. So voting matrix for X = 1.....m and Y=1.....n, can be calulated with formula shown in picuture.
standard deviation sigma can be left as 1.
So how to calculate that expression in an efficient way?
Thanks

回答 (1 件)

Sukuchha
Sukuchha 2012 年 10 月 16 日
this is what i tried so far.
Image = zeros(10,10);
% put ones
Image(5,5)=1;
Image(10,10)=1;
[x,y]=meshgrid(1:10,1:10);
%for location 5,5
total = exp(-((x-5)^2+(y-5)^2));
But my total matrix is all zeros except total(5,5) is one. I expected to have in other cordinates some fractions. Am i doing something wrong.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by