Home > src > BN_pol_rec > Hsand > extractRoadsCoverWaterPx_bup.m

extractRoadsCoverWaterPx_bup

PURPOSE ^

040407 RS. Classify px according to colour

SYNOPSIS ^

function [roadPoints, costMap, Green, Water] = extractRoadsCoverWaterPx(A)

DESCRIPTION ^

 040407 RS. Classify px according to colour
 roadPoints =  Road matrix 1 if black; 0 if not black
 Green =  Green matrix 1 if green; 0 if not green
 Water =  Blue matrix 1 if blue; 0 if not blue

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 function [roadPoints, costMap, Green, Water] = extractRoadsCoverWaterPx(A)
0003 
0004 % 040407 RS. Classify px according to colour
0005 % roadPoints =  Road matrix 1 if black; 0 if not black
0006 % Green =  Green matrix 1 if green; 0 if not green
0007 % Water =  Blue matrix 1 if blue; 0 if not blue
0008 
0009 % Cost for different types of terrain
0010 water = 100;
0011 road = 1;
0012 urabanArea = 10;
0013 grass = 5;
0014 
0015 %initialize
0016 roadPoints = zeros(size(A(:,:,1)));
0017 costMap= ones(size(A(:,:,1)));
0018 Green = zeros(size(A(:,:,1)));
0019 Water = zeros(size(A(:,:,1)));
0020 
0021 for i = 1:length(A(:,1,1))
0022     for j=1:length(A(1,:,1))
0023        costMap(i,j) = urabanArea;
0024        [col] = findColor(A(round(i),round(j),:));
0025         if (col(2) == 1)
0026             costMap(i,j) = grass;
0027             Green(i,j) = 1;
0028         end;
0029         if (col(3) == 1)
0030             costMap(i,j) = water;
0031             Water(i,j) = 1;
0032         end;
0033         if (col(5) == 1)
0034             roadPoints(i,j) = 1;
0035             costMap(i,j) = road;
0036         end;
0037 %REMOVE A.S.A.P.--------------------------------------------------------->
0038  if costMap(i,j) == 0
0039             costMap(i,j) = grass;
0040  end;
0041  %REMOVE A.S.A.P.<---------------------------------------------------------
0042 
0043 
0044         col = zeros(size(col));
0045     end
0046 end
0047 
0048 
0049  
0050

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003