-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
fb3ef41
commit ce27dca
Showing
16 changed files
with
1,301 additions
and
16 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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
# vectofil+ | ||
A program to perform Basic Vector Directional Filtering for the noisy color images. This a project of Computer Vision and Image Processing course in West Pomeranian University of Technology. | ||
A program to perform Basic Vector Directional Filtering for the noisy colour images. This a project of Computer Vision and Image Processing course in West Pomeranian University of Technology. | ||
|
||
For the demostration, check out Results directory, or [see the GUI on YouTube](https://www.youtube.com/watch?v=pXBCrB0VlLY). | ||
For the demonstration, check out Results directory, or [see the GUI on YouTube](https://www.youtube.com/watch?v=pXBCrB0VlLY). | ||
|
||
### What we will add? | ||
- Save the output functionality. | ||
- Save the process as a PDF and PNGs functionality | ||
- Choosing the Vector Median Filtering or Basic Vector Directional Filtering process. Comperasion between two filters. | ||
- Percentage addition between VMF and BVDF. | ||
- Much more pretty UI! | ||
- Documentation for every function. Especially lots of comments on the file of BVDF_FILTER. | ||
|
||
- [ ] Save the output functionality. | ||
|
||
- [ ] Save the process as a PDF and PNGs functionality. | ||
|
||
- [x] Choosing the Vector Median Filtering or Basic Vector Directional Filtering process. Comperasion between two filters. | ||
|
||
- [x] Percentage addition between VMF and BVDF. | ||
|
||
- [x] Much more pretty UI! | ||
|
||
- [ ] Documentation for every function. Especially lots of comments on the file of BVDF_FILTER. | ||
|
||
### License | ||
This is a art of open source. Please make sure that you also create an open source for the public good. | ||
|
||
License: GNU v2 | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
File renamed without changes.
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
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 @@ | ||
% COLORIMAGEDIFFERENCE | ||
|
||
function [resultedImage, differentPixelCount] = ColorImageDifference(image1, image2) | ||
sizeImg1 = size(image1); | ||
sizeImg2 = size(image2); | ||
differentPixelCount = 0; | ||
|
||
if (sizeImg1 - sizeImg2) ~= zeros(1, 3) | ||
error("Given input images' sizes are not matched."); | ||
end | ||
|
||
resultedImage = zeros(sizeImg1); | ||
|
||
for rowPixel = 1:sizeImg1(1) | ||
for colPixel = 1:sizeImg1(2) | ||
if min(... | ||
image1(rowPixel, colPixel, :) == image2(rowPixel, colPixel, :)... | ||
) == 0 | ||
|
||
resultedImage(rowPixel, colPixel, :) = [255, 255, 255]'; | ||
differentPixelCount = differentPixelCount + 1; | ||
end | ||
end | ||
end | ||
end |
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,73 @@ | ||
function filtered_image = DistanceDirectionalFilter(corrupted_image, window_size, BVDFratio, yValueVMF) | ||
image_X = size(corrupted_image, 1); | ||
image_Y = size(corrupted_image, 2); | ||
|
||
filtered_image = zeros(size(corrupted_image)); | ||
starting_points = [ceil(window_size/2), ceil(window_size/2)]; | ||
choosing_distance = [floor(window_size/2), floor(window_size/2)]; | ||
|
||
for x_index = starting_points(1):(image_X-starting_points(1)) | ||
for y_index = starting_points(2):(image_Y-starting_points(2)) | ||
|
||
area2filter = corrupted_image(x_index-choosing_distance(1):x_index+choosing_distance(2),... | ||
y_index-choosing_distance(2):y_index+choosing_distance(2), :); | ||
area2filter = im2double(area2filter).*255; | ||
vectors_list = reshape(area2filter , [], 3)'; | ||
|
||
% Sorting Process | ||
% In here, one array of vectors is created. First row will give | ||
% us the distances calculated with VMF, second row will give us | ||
% the angles calculated with BVDF. That's why there is "+2". | ||
calculations = zeros(size(vectors_list, 1) + 3, size(vectors_list, 2)); | ||
calculations(4:end, :) = vectors_list; | ||
|
||
for index = 1:size(vectors_list, 2) | ||
for jndex = 1:size(vectors_list, 2) | ||
|
||
% For each pixel, we are choosing the window-size of | ||
% pixels, and calculate the angles and distances from | ||
% them. | ||
|
||
vectA = vectors_list(:, index); | ||
vectB = vectors_list(:, jndex); | ||
|
||
if vectA == vectB | ||
continue; | ||
end | ||
|
||
% BVDF method for window-sized vectors. | ||
calculations(3, index) = calculations(2, index) + ... | ||
acosd(dot(vectA, vectB) / (norm(vectA) * norm(vectB))); | ||
|
||
% VMF method for window-sized vectors with Euclodien distances. | ||
colorRed = (vectA(1) - vectB(1)).^(yValueVMF); | ||
colorGreen = (vectA(2) - vectB(2)).^(yValueVMF); | ||
colorBlue = (vectA(3) - vectB(3)).^(yValueVMF); | ||
VMF_distance = (colorRed + colorGreen + colorBlue).^(1/yValueVMF); | ||
calculations(2, index) = calculations(2, index) + VMF_distance; | ||
|
||
end | ||
end | ||
|
||
% Combination of VMF and BVDF: Distance Directional Filter | ||
calculations(1, :) = (calculations(3, :).^(BVDFratio)) .* (calculations(2, :).^(1-BVDFratio)); | ||
|
||
% Sorting the vectors inside the window, with the rules of BVDF | ||
% and VMF. | ||
% [~, VMForder] = sort(calculations(2, :)); | ||
% [~, BVDForder] = sort(calculations(3, :)); | ||
% VMFSortedVects = calculations(3:end, VMForder); | ||
% BVDFSortedVects = calculations(3:end, BVDForder); | ||
% VMF_Vector = VMFSortedVects(:, 1); | ||
% BVDF_Vector = BVDFSortedVects(:, 1); | ||
[~, DDForder] = sort(calculations(1, :)); | ||
DDFSortedVects = calculations(4:end, DDForder); | ||
DDF_Vector = DDFSortedVects(:, 1); | ||
|
||
filtered_image(x_index, y_index, :) = DDF_Vector; | ||
|
||
end | ||
end | ||
|
||
filtered_image = cast(filtered_image, 'uint8'); | ||
end |
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
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,29 @@ | ||
function VMF_BVDF_Present(corrupted_image) | ||
vmf_result = VectorMedianFilter(corrupted_image, 3); | ||
bvdf_result = bvdf_filter(corrupted_image, 3); | ||
[diff_img, diff_img_count] = ColorImageDifference(vmf_result, bvdf_result); | ||
hybrid_result = VMF_BVDF_Combine(corrupted_image, 3); | ||
|
||
SameRatio = (size(corrupted_image, 1) .* size(corrupted_image, 2) - diff_img_count) ... | ||
/ (size(corrupted_image, 1) .* size(corrupted_image, 2)); | ||
sprintf("Sameness Ratio: %d", SameRatio); | ||
|
||
tiledlayout(2,3) | ||
nexttile | ||
imshow(corrupted_image) | ||
title("Corrupted Image") | ||
nexttile | ||
imshow(vmf_result) | ||
title("VMF") | ||
nexttile | ||
imshow(bvdf_result) | ||
title("BVDF") | ||
nexttile | ||
imshow(diff_img) | ||
title("Img Diff") | ||
nexttile | ||
imshow(hybrid_result) | ||
title("Hybrid") | ||
|
||
|
||
end |
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,135 @@ | ||
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0"> | ||
<configuration file="/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters/VectofilPlus.prj" location="/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters" name="VectofilPlus" target="target.ezdeploy.standalone" target-name="Application Compiler"> | ||
<param.appname>VectofilPlus</param.appname> | ||
<param.icon /> | ||
<param.icons /> | ||
<param.version>1.0</param.version> | ||
<param.authnamewatermark>Gökhan Koçmarlı</param.authnamewatermark> | ||
<param.email>gokhankocmarli@gmail.com</param.email> | ||
<param.company>West Pomeranian University of Technology</param.company> | ||
<param.summary>A GUI based application to create noise, and filter color images with Basic Vector Directional Filters.</param.summary> | ||
<param.description /> | ||
<param.screenshot /> | ||
<param.guid /> | ||
<param.installpath.string>/VectofilPlus/</param.installpath.string> | ||
<param.installpath.combo>option.installpath.user</param.installpath.combo> | ||
<param.logo /> | ||
<param.install.notes /> | ||
<param.target.install.notes>In the following directions, replace MR/v910 by the directory on the target machine where MATLAB is installed, or MR by the directory where the MATLAB Runtime is installed. | ||
|
||
(1) Set the environment variable XAPPLRESDIR to this value: | ||
|
||
MR/v910/X11/app-defaults | ||
|
||
|
||
(2) If the environment variable LD_LIBRARY_PATH is undefined, set it to the following: | ||
|
||
MR/v910/runtime/glnxa64:MR/v910/bin/glnxa64:MR/v910/sys/os/glnxa64:MR/v910/sys/opengl/lib/glnxa64 | ||
|
||
If it is defined, set it to the following: | ||
|
||
${LD_LIBRARY_PATH}:MR/v910/runtime/glnxa64:MR/v910/bin/glnxa64:MR/v910/sys/os/glnxa64:MR/v910/sys/opengl/lib/glnxa64</param.target.install.notes> | ||
<param.intermediate>${PROJECT_ROOT}/VectofilPlus/for_testing</param.intermediate> | ||
<param.files.only>${PROJECT_ROOT}/VectofilPlus/for_redistribution_files_only</param.files.only> | ||
<param.output>${PROJECT_ROOT}/VectofilPlus/for_redistribution</param.output> | ||
<param.logdir>${PROJECT_ROOT}/VectofilPlus</param.logdir> | ||
<param.enable.clean.build>false</param.enable.clean.build> | ||
<param.user.defined.mcr.options /> | ||
<param.target.type>subtarget.standalone</param.target.type> | ||
<param.support.packages /> | ||
<param.web.mcr>true</param.web.mcr> | ||
<param.package.mcr>false</param.package.mcr> | ||
<param.no.mcr>false</param.no.mcr> | ||
<param.web.mcr.name>MyAppInstaller_web</param.web.mcr.name> | ||
<param.package.mcr.name>MyAppInstaller_mcr</param.package.mcr.name> | ||
<param.no.mcr.name>MyAppInstaller_app</param.no.mcr.name> | ||
<param.windows.command.prompt>false</param.windows.command.prompt> | ||
<param.create.log>false</param.create.log> | ||
<param.log.file /> | ||
<param.native.matlab>false</param.native.matlab> | ||
<param.checkbox>false</param.checkbox> | ||
<param.example /> | ||
<param.help.text>Syntax | ||
-? | ||
|
||
Input Arguments | ||
-? print help on how to use the application | ||
input arguments</param.help.text> | ||
<unset> | ||
<param.icon /> | ||
<param.icons /> | ||
<param.version /> | ||
<param.description /> | ||
<param.screenshot /> | ||
<param.guid /> | ||
<param.installpath.combo /> | ||
<param.logo /> | ||
<param.install.notes /> | ||
<param.intermediate /> | ||
<param.files.only /> | ||
<param.output /> | ||
<param.logdir /> | ||
<param.enable.clean.build /> | ||
<param.user.defined.mcr.options /> | ||
<param.target.type /> | ||
<param.support.packages /> | ||
<param.web.mcr /> | ||
<param.package.mcr /> | ||
<param.no.mcr /> | ||
<param.web.mcr.name /> | ||
<param.package.mcr.name /> | ||
<param.no.mcr.name /> | ||
<param.windows.command.prompt /> | ||
<param.create.log /> | ||
<param.log.file /> | ||
<param.native.matlab /> | ||
<param.checkbox /> | ||
<param.example /> | ||
</unset> | ||
<fileset.main> | ||
<file>${PROJECT_ROOT}/GUI/vectofil.mlapp</file> | ||
</fileset.main> | ||
<fileset.resources /> | ||
<fileset.package /> | ||
<fileset.depfun /> | ||
<build-deliverables> | ||
<file location="${PROJECT_ROOT}/VectofilPlus/for_testing" name="run_VectofilPlus.sh" optional="false">/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters/VectofilPlus/for_testing/run_VectofilPlus.sh</file> | ||
<file location="${PROJECT_ROOT}/VectofilPlus/for_testing" name="VectofilPlus" optional="false">/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters/VectofilPlus/for_testing/VectofilPlus</file> | ||
<file location="${PROJECT_ROOT}/VectofilPlus/for_testing" name="splash.png" optional="false">/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters/VectofilPlus/for_testing/splash.png</file> | ||
<file location="${PROJECT_ROOT}/VectofilPlus/for_testing" name="readme.txt" optional="true">/media/pop49/Data/Projeler/Dersler/West Pomaranian University of Technology/Computer Vision and Image Processing/Basic Vector Directional Filters/VectofilPlus/for_testing/readme.txt</file> | ||
</build-deliverables> | ||
<workflow /> | ||
<matlab> | ||
<root>/media/pop49/LinuxApps/MATLABR2021A</root> | ||
<toolboxes> | ||
<toolbox name="matlabcoder" /> | ||
<toolbox name="embeddedcoder" /> | ||
</toolboxes> | ||
<toolbox> | ||
<matlabcoder> | ||
<enabled>true</enabled> | ||
</matlabcoder> | ||
</toolbox> | ||
<toolbox> | ||
<embeddedcoder> | ||
<enabled>true</enabled> | ||
</embeddedcoder> | ||
</toolbox> | ||
</matlab> | ||
<platform> | ||
<unix>true</unix> | ||
<mac>false</mac> | ||
<windows>false</windows> | ||
<win2k>false</win2k> | ||
<winxp>false</winxp> | ||
<vista>false</vista> | ||
<linux>true</linux> | ||
<solaris>false</solaris> | ||
<osver>5.11.0-7620-generic</osver> | ||
<os32>false</os32> | ||
<os64>true</os64> | ||
<arch>glnxa64</arch> | ||
<matlab>true</matlab> | ||
</platform> | ||
</configuration> | ||
</deployment-project> |
Oops, something went wrong.