Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jrethore/ufreckles
21 April 2026, 21:14:19 UTC
  • Code
  • Branches (4)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/heads/v2.0
    • refs/heads/v2.1
    • refs/heads/v2.2
    No releases to show
  • 5ade5ef
  • /
  • Stereovision
  • /
  • Extract3DFields.m
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:9c7520f864bc58c6c6377fe7a41f19bea3fea76f
origin badgedirectory badge
swh:1:dir:05337df9e53fc078fce384b62d2accbc62d447b1
origin badgerevision badge
swh:1:rev:c38c036275d400217c433acd624a7e968a09fb55
origin badgesnapshot badge
swh:1:snp:e93363e05fc035dd2687d48111453842fa57bff8

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: c38c036275d400217c433acd624a7e968a09fb55 authored by Julien Réthoré on 16 June 2025, 12:35:44 UTC
update june 2025
Tip revision: c38c036
Extract3DFields.m
function [U,X3,Y3,Z3]=Extract3DFields(Uo,nmod,iscale)
if nargin<3,iscale=1;end
load(fullfile('TMP','params'),'param');
param0=param;
load(fullfile('TMP',sprintf('%d_params',nmod)),'param');
nurbs=strcmp(param.basis,'nurbs');
if iscell(param0.reference_image)
    ncamr=length(param0.reference_image);
    docrosscorrelation=0;
    if isfield(param0,'cross_correlation')
        docrosscorrelation=param0.cross_correlation;
    end
else
    ncamr=1;
    docrosscorrelation=0;
end
if iscell(param0.deformed_image)
    nim=size(param0.deformed_image,2);
    ncamd=size(param0.deformed_image,1);
else
    nim=1;
    ncamd=1;
end
if ncamr==1
    indcam=ncamd:-1:1;
else
    if docrosscorrelation
        indo=(ncamd:-1:1)';
        indcam=indo';
        for ic=1:ncamd-1
            indo=circshift(indo,1);
            indcam=[indcam;indo'];
        end
    else
        indcam=(1:ncamd)';
    end
end
pscale=2^(iscale-1);
Nddl=size(Uo,1)/2;
dotopo=~(isfield(param,'topography'));%||isfield(param,'mesh_file'));
if ~dotopo
    if nurbs
        load(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(1-1),iscale-1)),'PX','PY','PZ');
        X3=PX(:);Y3=PY(:);Z3=PZ(:);dec=0;
    else
        load(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(1-1),iscale-1)),'Xo','Yo','Zo');
        X3=Xo;Y3=Yo;Z3=Zo;dec=0;
    end
else
    dec=1;
end
U=zeros(3*Nddl,nim-dec);
for ijm=1:nim
    
    phi=[];
    X=[];
    for icamr=1:ncamr
        if ijm==1||ncamr>1
            %  load(fullfile('TMP',sprintf('%d_phix_%d',nmod*10^(icamr-1),10*(1-1))),'phix','Xi','Yi');
            %  load(fullfile('TMP',sprintf('%d_phiy_%d',nmod*10^(icamr-1),10*(1-1))),'phiy');
            if nurbs
                load(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(icamr-1),iscale-1)),'Px','Py');
                Xi=Px(:);Yi=Py(:);
            else
                load(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(icamr-1),iscale-1)),'xo','yo');
                Xi=(xo-0.5)*pscale+0.5;
                Yi=(yo-0.5)*pscale+0.5;
            end
            phix=[diag(sparse(ones(length(Xi),1))),sparse(length(Xi),length(Xi))];
            phiy=[sparse(length(Xi),length(Xi)),diag(sparse(ones(length(Xi),1)))];
            phio=phix(:,1:Nddl);
            load(fullfile('TMP',sprintf('sample%d',(icamr-1))),'sizeim','roi');
        end
        for icamd=1:size(indcam,2)
            iz=indcam(icamr,icamd)+(icamr-1)*size(indcam,2)*docrosscorrelation;
            Ux=phix*Uo(:,ijm,iz);
            Uy=phiy*Uo(:,ijm,iz);
            xsi=roi(1)-1+Ux+Xi-0.5*(sizeim(1)+1);
            ysi=roi(3)-1+Uy+Yi-0.5*(sizeim(2)+1);
            C=param0.calibration_data{indcam(icamr,icamd)};
            fx=C(1);fy=C(2);
            cx=C(3);cy=C(4);
            tx=C(5);ty=C(6);tz=C(7);
            %correct distortion
            if length(C)>16
                k1=C(17);k2=C(18);k3=C(19);
                xsio=xsi;
                ysio=ysi;
                res=1;
                while res>1.e-6
                    zs=(xsi-cx+1i*(ysi-cy));
                    rs=abs(zs);
                    d=rs.*(k1+rs.*(k2+k3*rs)).*exp(1i*angle(zs));
                    dxsi=xsio-real(d)-xsi;
                    dysi=ysio-imag(d)-ysi;
                    xsi=xsi+dxsi;
                    ysi=ysi+dysi;
                    res=max(max(abs(dxsi./xsi)),max(abs(dysi./ysi)));
                end
            end
            R=reshape(C(8:16),3,3);
            Xxi=-(xsi-cx)*tz-fx*tx;
            Xyi=-(ysi-cy)*tz-fy*ty;
            %Xxi=(xsi-cx)*tz-fx*tx;
            %Xyi=(ysi-cy)*tz-fy*ty;
            X=[X;Xxi;Xyi];
            phixi=[diag(sparse(fx*R(1,1)+R(3,1)*(xsi-cx)))*phio,diag(sparse(fx*R(1,2)+R(3,2)*(xsi-cx)))*phio,diag(sparse(fx*R(1,3)+R(3,3)*(xsi-cx)))*phio];
            phiyi=[diag(sparse(fy*R(2,1)+R(3,1)*(ysi-cy)))*phio,diag(sparse(fy*R(2,2)+R(3,2)*(ysi-cy)))*phio,diag(sparse(fy*R(2,3)+R(3,3)*(ysi-cy)))*phio];
            %  phixi=[diag(sparse(fx*R(1,1)-R(3,1)*(xsi-cx)))*phio,diag(sparse(fx*R(1,2)-R(3,2)*(xsi-cx)))*phio,diag(sparse(fx*R(1,3)-R(3,3)*(xsi-cx)))*phio];
            %  phiyi=[diag(sparse(fy*R(2,1)-R(3,1)*(ysi-cy)))*phio,diag(sparse(fy*R(2,2)-R(3,2)*(ysi-cy)))*phio,diag(sparse(fy*R(2,3)-R(3,3)*(ysi-cy)))*phio];
            phi=[phi;phixi;phiyi];
        end
    end
    M=phi'*phi;
    F=phi'*X;
    XYZo=M\F;
    Xo=XYZo((1:Nddl));
    Yo=XYZo(Nddl+(1:Nddl));
    Zo=XYZo(2*Nddl+(1:Nddl));
    if ijm==1&&dotopo
        X3=Xo;Y3=Yo;Z3=Zo;
        if ijm==1
            if nurbs
                PX=Xo;PY=Yo;PZ=Zo;
                save(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(icamr-1),iscale-1)),'PX','PY','PZ','-append');
            else
                save(fullfile('TMP',sprintf('%d_mesh_%d',nmod*10^(icamr-1),iscale-1)),'Xo','Yo','Zo','-append');
            end
        end
        
    else
        U((1:Nddl),ijm-dec)=Xo-X3;
        U(Nddl+(1:Nddl),ijm-dec)=Yo-Y3;
        U(2*Nddl+(1:Nddl),ijm-dec)=Zo-Z3;
    end
end
end

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API