From fedf4d05bc145c4e8fce4341e3874d8a793b31ec Mon Sep 17 00:00:00 2001 From: Nathan Perkins Date: Mon, 6 Apr 2015 10:05:06 -0400 Subject: [PATCH] Optimize RX. Fix color space list. --- RX_global.m | 8 +++++--- run_script.m | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RX_global.m b/RX_global.m index 2b38dab..56493fd 100644 --- a/RX_global.m +++ b/RX_global.m @@ -13,13 +13,15 @@ % Create mean color column vector mu=mean(CC)'; +% Preallocate +img_out = zeros(img_size1, img_size2); + for i=1:img_size1 for j=1:img_size2 % Locate center pixel and convert to column vector - r=reshape(Data(i,j,:),channels,[]); + r = squeeze(Data(i, j, :)); % Run RX detector on center pixel - d(1+i,1+j)=(r-mu)'*K^-1*(r-mu); + img_out(i,j)=(r-mu)'/K*(r-mu); end end -img_out=d; diff --git a/run_script.m b/run_script.m index afebec2..c1fe23d 100644 --- a/run_script.m +++ b/run_script.m @@ -13,7 +13,7 @@ function run_script(scene_file) color_spaces{end + 1} = @(img) select_channel(im_rgb2upvpl(img), 1:2); color_spaces{end + 1} = @(img) select_channel(im_rgb2uvl(img), 1:2); color_spaces{end + 1} = @(img) select_channel(im_rgb2xyz(img), [1 3]); -color_spaces{end + 1} = @(img) select_channel(im_rgb2lab(img), [1 3]); +color_spaces{end + 1} = @(img) select_channel(im_rgb2xyy(img), [1 3]); color_spaces{end + 1} = @(img) transform_channel(im_rgb2lab(img), 1, @log); % load file