파일:Regression elliptique distance algebrique donnees gander.svg

testwiki
둘러보기로 이동 검색으로 이동
    원본 파일 (SVG 파일, 실제 크기 452 × 364 픽셀, 파일 크기: 21 KB)

    이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.

    파일 설명

    설명
    English: Ellipse fitting, using the method of the algebraic distance. Fitzgibbon algorithm (Halíř and Flusser 1998), with test data from Gander et al. 1994.
    Français : Régression elliptique, méthode de la distance algébrique. Algorithme de Fitzgibbon, avec les données test de Gander et coll. 1994.
    날짜
    출처

    다음을 기초로 한 자작:

    저자 Cdang
    SVG 발전
    InfoField
     이 SVG 파일의 소스 코드 문법이 올바릅니다.
     이 다이어그램 Inkscape(으)로 cdang에 의해서제작되었습니다.
      이 SVG 다이어그램은 내장된 문자열을 사용하고 있으며 문서 편집기를 사용해서 쉽게 번역할 수 있습니다.

    Parameters of the ellipse:

    • center: (4.64 ; 4.80);
    • major semi-axis: a = 3.91;
    • minor semi-axis: b = 2.96;
    • tilt angle: φ = -9.21°.

    Source code

    Scilab – free and open source software for numerical computation의 로고
    Scilab – free and open source software for numerical computation의 로고
    This media was created with Scilab (free and open source software for numerical computation)
    Here is a listing of the source used to create this file.

    Deutsch ∙ македонски ∙ English ∙ +/−

    // **********
    // Initialisation
    // **********
    
    clear;
    
    // **********
    // Données
    // **********
    
    X0 = [1, 2, 5, 7, 9, 6, 3, 8];
    Y0 = [7, 6, 8, 7, 5, 7, 2, 4];
    
    // **********
    // Fonctions
    // **********
    
    function [a] = regression_elliptique(X, Y) // Fitzgibbon
        // méthode de la distance algébrique
        // X, Y : points expérimentaux, matrices colonnes réelles
        // a : coefficients de la formule quadratique (matrice colonne réelle)
        D = [X.*X, X.*Y, Y.*Y, X, Y, ones(X)]; // matrice de conception (design m.)
        S = D'*D; // matrice de dispersion (scatter m.)
        C = zeros(6,6);
        C(1,3) = 2; C(2,2) = -1; C(3,1) = 2; // matrice de contrainte
        [vecpropres, valpropres] = spec(inv(S)*C); // détermination du
        // système propre
        if imag(vecpropres) <> 0 then
            error('Les vecteurs propres contiennent des valeurs complexes')
        end
        if imag(valpropres) <> 0 then
            error('Les valeurs propres contiennent des valeurs complexes')
        end
        vecpropres = real(vecpropres); // complexes -> réels
        valpropres = real(valpropres);
        [PosLigne, PosColonne] = find((valpropres > 0 & ~isinf(valpropres)));
        // recherche les indices des valeurs propres positives
        a = vecpropres(:, PosLigne); // vecteur propre correspondant
    endfunction
    
    function [phi]=trouve_rotation(A)
        // A : coefficients de la formule quadratique (matrice colonne réelle)
        // phi : angle que fait un axe de l'ellipse avec x (radians)
        delta = 1 - 1/(1 + (A(3) - A(1))^2/A(2)^2);
        absphi = acos(sqrt((1 + sqrt(delta))/2));
        signephi = sign(A(2)*(cos(absphi)^2 - sin(absphi)^2)/(A(1) - A(3)));
        phi = signephi*absphi;
    endfunction
    
    function [x,y]=trouve_centre(A)
        // A : coefficients de la formule quadratique (matrice colonne réelle)
        // x, y : coordonées du centre de l'ellipse (réels)
        delta = A(2)^2 - 4*A(1)*A(3);
        x = (2*A(3)*A(4) - A(2)*A(5))/delta;
        y = (2*A(1)*A(5) - A(2)*A(4))/delta;
    endfunction
    
    function [rx, ry]=trouve_rayons(a, phi, xc, yc)
        // a : coefficients de la formule quadratique (matrice colonne réelle)
        // phi : angle que fait un axe de l'ellipse avec x
        // xc, yc : coordonnées du centre de l'ellipse
        // rx, ry : rayons (grand et petit demi-grands axes) de l'ellipse
        A = [a(1), a(2)/2 ; a(2)/2, a(3)];
        Q = rotate([1,0;0,1], phi); // matrice de rotation
        t = [xc;yc]; // matrice de translation
        Abar = Q'*A*Q;
        b = [a(4);a(5)];
        bbar = (2*t'*A + b')*Q;
        c = a(6);
        cbar = t'*A*t + b'*t + c;
        rx = sqrt(-cbar/Abar(1,1));
        ry = sqrt(-cbar/Abar(2,2));
    endfunction
    
    function [] = trace_ellipse(xc, yc, a, b, phi)
        // trace l'ellipse de centre (xc, yc)
        // de rayons a et b et tournée de phi
        pas = 0.1;
        t = 0:pas:%pi/2;
        X = a*cos(t);
        Y = b*sin(t);
        n = 4*size(X,'*');
        XY1 = [X, -flipdim(X,2), -X, flipdim(X,2);...
            Y, flipdim(Y,2), -Y, -flipdim(Y,2)];
        XY = rotate(XY1, phi) + [xc*ones(1,n);yc*ones(1,n)];
        xpoly(XY(1,:), XY(2,:));
    endfunction
    
    // **********
    // Programme principal
    // **********
    
    // lecture des données
    
    Xdef = X0';
    Ydef = Y0';
    
    // Régression
    aopt = regression_elliptique(Xdef, Ydef);
    
    // affichage des paramètres
    disp(aopt)
    
    phi = trouve_rotation(aopt);
    phideg = phi*180/%pi;
    [xc, yc] = trouve_centre(aopt);
    [a, b] = trouve_rayons(aopt, phi, xc, yc);
    disp('phi = '+string(phi)+' rad = '+string(phideg)+'°.');
    disp('C('+string(xc)+' ; '+string(yc)+').');
    disp('a = '+string(a)+' ; b = '+string(b)+'.');
    
    // tracé
    clf;
    
    plot(Xdef, Ydef, 'b+')
    isoview(0, 10, 1, 9);
    plot(xc, yc, 'r+')
    trace_ellipse(xc, yc, a, b, phi);
    ell = gce();
    ell.foreground = 5;
    

    It is also possible to use the Halíř algorithm (split matrices). The algorithm is more stable, and the result is the same.

    function [a] = regression_elliptique(X, Y) // Halir
        // méthode de la distance algébrique
        // X, Y : points expérimentaux, matrices colonnes réelles
        // a : coefficients de la formule quadratique (matrice colonne réelle)
        D1 = [X.*X, X.*Y, Y.*Y];
        D2 = [X, Y, ones(X)];
        // matrices de conception (design m.)
        S1 = D1'*D1; 
        S2 = D1'*D2;
        S3 = D2'*D2;
        // matrices de dispersion (scatter m.)
        T = -inv(S3)*S2';
        N = S1+ S2*T;
        M = [0.5*N(3, :) ; -N(2,:) ; 0.5*N(1, :)]; // mult par inv(C1) à gauche
        // matrice de dispersion réduite
        [vecpropres, valpropres] = spec(M);
        vep = real(vecpropres);
        // détermination du système propre
        condition = 4*vep(1, :).*vep(3, :) - vep(2, :).^2;
        // évaluation de a'Ca
        a1 = vep(:, find(condition > 0));
        a = [a1 ; T*a1]; // vecteur propre correspondant à la solution
    endfunction
    

    라이선스

    나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
    GNU head GNU 자유 문서 사용 허가서 1.2판 또는 자유 소프트웨어 재단에서 발행한 이후 판의 규정에 따라 본 문서를 복제하거나 개작 및 배포할 수 있습니다. 본 문서에는 변경 불가 부분이 없으며, 앞 표지 구절과 뒷 표지 구절도 없습니다. 본 사용 허가서의 전체 내용은 GNU 자유 문서 사용 허가서 부분에 포함되어 있습니다.
    w:ko:크리에이티브 커먼즈
    저작자표시 동일조건변경허락
    이 파일은 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0, 2.5, 2.0, 1.0 라이선스로 배포됩니다.
    이용자는 다음의 권리를 갖습니다:
    • 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
    • 개작 – 저작물의 개작, 수정, 2차적저작물 창작
    다음과 같은 조건을 따라야 합니다:
    • 저작자표시 – 적절한 저작자 표시를 제공하고, 라이선스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.
    • 동일조건변경허락 – 만약 당신이 이 저작물을 개작 또는 변형하거나 이 저작물을 기반으로 제작하는 경우, 당신은 당신의 기여물을 원저작물과 동일하거나 호환 가능한 라이선스에 따라 배포하여야 합니다.
    이 라이선스 중에서 목적에 맞는 것을 선택하여 사용할 수 있습니다.

    설명

    이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

    이 파일에 묘사된 항목

    다음을 묘사함

    21,353 바이트

    image/svg+xml

    15a475ae0ba99eb36f115326514e62a2d0ff10b9

    파일 역사

    날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

    날짜/시간섬네일크기사용자설명
    현재2012년 12월 21일 (금) 11:022012년 12월 21일 (금) 11:02 판의 섬네일452 × 364 (21 KB)wikimediacommons>Cdang{{Information |Description ={{en|1=sign error in algorithm}} |Source ={{own}} |Author =Cdang |Date = |Permission = |other_versions = }}

    이 파일을 사용하는 문서가 없습니다.