function [detections] = polsar_cfar_detector(cov, params) % Inputs: % cov - POLSAR covariance matrix % params - an array containing the values of guard_cells, training_cells, threshold_factor % % Outputs: % detections - a binary image indicating the detected targets % Get the dimensions of the covariance matrix [M, N] = size(cov); % Calculate the number of cells used in the CFAR algorithm total_cells = (2params(1)+2params(2)+1)^2; training_cells_per_group = 2params(2)+1; guard_cells_per_group = 2params(1)+1; % Initialize the output image detections = zeros(M,N); % Loop over each pixel in the image for i = 1+params(1):M-params(1) for j = 1+params(1):N-params(1) % Extract the training region train_region = cov(i-params(1)-params(2):i+params(1)+params(2), j-params(1)-params(2):j+params(1)+params(2)); % Calculate the threshold using the CFAR algorithm sorted_train_region = sort(train_region(:)); noise = mean(sorted_train_region(1:total_cells-training_cells_per_group*guard_cells_per_group)); threshold = params(3)*noise; % Check if the current pixel is greater than the threshold if cov(i,j) > threshold detections(i,j) = 1; end end end end优化使该功能函数输入只有一个协方差矩阵
时间: 2023-06-15 15:06:10 浏览: 93
CFAR检测程序,cfar检测原理通俗解释,matlab
5星 · 资源好评率100%
function [detections] = polsar_cfar_detector(cov, params) % Inputs: % cov - POLSAR covariance matrix % params - an array containing the values of guard_cells, training_cells, threshold_factor % % Outputs: % detections - a binary image indicating the detected targets % Get the dimensions of the covariance matrix [M, N] = size(cov); % Calculate the number of cells used in the CFAR algorithm total_cells = (2*params(1)+2*params(2)+1)^2; training_cells_per_group = 2*params(2)+1; guard_cells_per_group = 2*params(1)+1; % Initialize the output image detections = zeros(M,N); % Loop over each pixel in the image for i = 1+params(1):M-params(1) for j = 1+params(1):N-params(1) % Extract the training region train_region = cov(i-params(1)-params(2):i+params(1)+params(2), j-params(1)-params(2):j+params(1)+params(2)); % Calculate the threshold using the CFAR algorithm sorted_train_region = sort(train_region(:)); noise = mean(sorted_train_region(1:total_cells-training_cells_per_group*guard_cells_per_group)); threshold = params(3)*noise; % Check if the current pixel is greater than the threshold if cov(i,j) > threshold detections(i,j) = 1; end end end end
阅读全文