% IMAGE_PROCESS - process sensor data related to a service % % IMAGE_PROCESS( SERVICE, OBSERVATIONS, SENSORS, TARGETS ) % % param: service - the service struct for this service % param: observations - an array of observations structs % param: sensors - call with an array of sensors corresponding to % the service, this yields the possibility to % param: targets - an array of all target structs % return: est_pos - the data corresponding to the service % return: quality - in this case the number of sensor that % contributed to the estimate % % AUTHOR Ronnie Johansson % CREATED 2004-12-20 % ALTERED %
0001 %% IMAGE_PROCESS - process sensor data related to a service 0002 %% 0003 %% IMAGE_PROCESS( SERVICE, OBSERVATIONS, SENSORS, TARGETS ) 0004 %% 0005 %% param: service - the service struct for this service 0006 %% param: observations - an array of observations structs 0007 %% param: sensors - call with an array of sensors corresponding to 0008 %% the service, this yields the possibility to 0009 %% param: targets - an array of all target structs 0010 %% return: est_pos - the data corresponding to the service 0011 %% return: quality - in this case the number of sensor that 0012 %% contributed to the estimate 0013 %% 0014 %% AUTHOR Ronnie Johansson 0015 %% CREATED 2004-12-20 0016 %% ALTERED 0017 %% 0018 0019 function [est_pos, quality] = image_process( service, observations, sensors, targets) 0020 0021 %% collect all observations from the sensors involved in this service 0022 0023 resources = service.resources; % get all id:s 0024 noOfResources = length( resources ); 0025 0026 relevant_observations = []; 0027 0028 for r=1:noOfResources 0029 relevant_observations = [ relevant_observations structextract(observations, 'sensor_id', resources{r}) ]; 0030 end 0031 0032 noOfObs = length( relevant_observations ); 0033 0034 0035 % calculate estimation and quality 0036 % this is a simple average over all observations 0037 0038 est_pos = nan; 0039 tmp_sum = 0; 0040 terms = 0; 0041 0042 if noOfObs < 1 0043 quality = 0; 0044 return; 0045 end 0046 0047 0048 for o=1:noOfObs 0049 obs = relevant_observations(o); 0050 if strcmp(obs.data_format, 'position') == 1 0051 terms = terms+1; 0052 tmp_sum = tmp_sum + obs.data; 0053 end 0054 end 0055 0056 est_pos = tmp_sum/terms; 0057 0058 quality = terms;