-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function img_out = RX_global(Data) | ||
% Perform RX algorithm on global of image | ||
|
||
% Dimensions of block | ||
img_size1=size(Data,1); | ||
img_size2=size(Data,2); | ||
channels=size(Data,3); | ||
|
||
% Separate block into color channels to calculate K matrix | ||
CC=reshape(Data,[],channels); | ||
K=cov(CC); | ||
|
||
% Create mean color column vector | ||
mu=mean(CC)'; | ||
|
||
for i=1:img_size1 | ||
for j=1:img_size2 | ||
% Locate center pixel and convert to column vector | ||
r=reshape(Data(i,j,:),channels,[]); | ||
|
||
% Run RX detector on center pixel | ||
d(1+i,1+j)=(r-mu)'*K^-1*(r-mu); | ||
end | ||
end | ||
img_out=d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters