1+ % Basé sur Wal. E IEEE PGA SAR Autofocus
2+
13function [corrected_image , total_phase_error , rms_history ] = pga_autofocus(sar_image , iterations )
24 [num_range , num_az ] = size(sar_image );
35 corrected_image = sar_image ;
46 total_phase_error = zeros(1 , num_az );
57 rms_history = zeros(1 , iterations );
68
79 % Sélection des bins les plus forts
8- num_bins_to_use = min(500 , num_range );
9- W = num_az ;
10+ num_bins_to_use = min(500 , num_range ); % Le paramètre en dur à modifier: critère de choix de ce paramètre ? (dynamique, taille )
11+ % W = num_az;
12+ W = 32 ; % Pareil que 2 lignes plus haut
1013 center_idx = floor(num_az / 2 ) + 1 ;
11-
1214 for iter = 1 : iterations
1315 % Sélection basée sur l'énergie
1416 energy = sum(abs(corrected_image ).^2 , 2 );
1517 [~ , sorted_idx ] = sort(energy , ' descend' );
1618 sel_idx = sorted_idx(1 : num_bins_to_use );
1719 sub_image = corrected_image(sel_idx , : );
1820
19- % 1. Circular Shifting
21+ %% 1. Circular Shifting
2022 [~ , max_pos ] = max(abs(sub_image ), [], 2 );
2123 shifted_img = zeros(num_bins_to_use , num_az );
2224 for r = 1 : num_bins_to_use
2325 shifted_img(r , : ) = circshift(sub_image(r , : ), center_idx - max_pos(r ));
2426 end
2527
26- % 2. Windowing progressif (20% par itération, min 5px)
28+ %% 2. Fenêtrage
2729 if iter > 1 , W = floor(W * 0.8 ); end
2830 W = max(W , 5 );
2931
3032 win = zeros(1 , num_az );
3133 w_start = max(1 , center_idx - floor(W / 2 ));
3234 w_end = min(num_az , center_idx + floor(W / 2 ));
3335 win(w_start : w_end ) = 1 ;
36+ display(w_end - w_start );
3437 g_n = bsxfun(@times , shifted_img , win );
3538
36- % 3. Estimation LUMV
37- % L'ASTUCE MATHEMATIQUE EST ICI :
38- % ifftshift(g_n, 2) annule la rampe de phase linéaire avant la FFT.
39- % On fait ensuite un fftshift pour réaligner l'axe de fréquence avec l'image globale.
39+ %% 3. Estimation de l'erreur de phase
4040 G_n = fftshift(fft(ifftshift(g_n , 2 ), [], 2 ), 2 );
4141 G_n_dot = [diff(G_n , 1 , 2 ), zeros(num_bins_to_use , 1 )];
4242
4343 num = sum(imag(conj(G_n ) .* G_n_dot ), 1 );
4444 den = sum(abs(G_n ).^2 , 1 ) + 1e- 12 ;
4545 phi_dot = num ./ den ;
4646
47- % 4. Intégration et Correction
47+ %% 4. Intégration et Correction
4848 phi_est = cumsum(phi_dot );
4949
50- % Suppression de la tendance linéaire pour empêcher l'image de dériver
50+ % Suppression de la tendance linéaire
5151 x_ax = 1 : num_az ;
5252 p = polyfit(x_ax , phi_est , 1 );
5353 phi_est = phi_est - polyval(p , x_ax );
5858 corrected_image = ifft(ifftshift(bsxfun(@times , img_freq , correction ), 2 ), [], 2 );
5959
6060 total_phase_error = total_phase_error + phi_est ;
61- rms_history(iter ) = sqrt(mean(phi_est .^ 2 ));
61+ rms_history(iter ) = sqrt(mean(phi_est .^ 2 )); % calcul du RMS
6262 end
6363end
0 commit comments