Optimization problem for ellipse fitting
Show older comments
I'm trying to "A robust ellipse fitting algorithm based on sparsity of outliers, Elaheh Sobhani" with MATLAB.
As I follow this paper, cost function & matrices do not converge but diverge.
Could you check if there's anything missing in the code?
Thx :)
Paper content ===========================================================

======================================================================
%% data vector setting
data_len = length(data);
X = [];
for i=1:data_len
data_x = data(i,1);
data_y = data(i,2);
x = [];
x = [data_x^2, data_x*data_y, data_y^2, data_x, data_y]';
X = [X,x];
end
X_T = transpose(X);
%% initialize o vector with the zero vector & one vector
o = zeros(data_len,1);
I = ones(data_len,1); %rescaling
lambda = 0.2;
%% Repeat part
loop_cnt = 0;
while true
loop_cnt = loop_cnt + 1;
disp(loop_cnt);
a = ctranspose(X_T)*(o + I);
for i = 1:data_len
o(i) = transpose(X(:,i)) * a - 1 - lambda * sign(o(i));
end
loss = 1/2 * norm( X_T * a - I - o, 2)^2 + lambda * norm(o,1);
if loss < 100
break;
end
end
Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!