Skip to content

Commit 8a2dc4c

Browse files
add: files of src, bin, and doc
1 parent 075a2d0 commit 8a2dc4c

14 files changed

+325
-0
lines changed
644 KB
Binary file not shown.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
VectofilPlus Executable
2+
3+
1. Prerequisites for Deployment
4+
5+
Verify that version 9.10 (R2021a) of the MATLAB Runtime is installed.
6+
If not, you can run the MATLAB Runtime installer.
7+
To find its location, enter
8+
9+
>>mcrinstaller
10+
11+
at the MATLAB prompt.
12+
13+
Alternatively, download and install the Linux version of the MATLAB Runtime for R2021a
14+
from the following link on the MathWorks website:
15+
16+
https://www.mathworks.com/products/compiler/mcr/index.html
17+
18+
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see
19+
"Distribute Applications" in the MATLAB Compiler documentation
20+
in the MathWorks Documentation Center.
21+
22+
2. Files to Deploy and Package
23+
24+
Files to Package for Standalone
25+
================================
26+
-VectofilPlus
27+
-run_VectofilPlus.sh (shell script for temporarily setting environment variables and
28+
executing the application)
29+
-to run the shell script, type
30+
31+
./run_VectofilPlus.sh <mcr_directory> <argument_list>
32+
33+
at Linux or Mac command prompt. <mcr_directory> is the directory
34+
where version 9.10 of the MATLAB Runtime is installed or the directory where
35+
MATLAB is installed on the machine. <argument_list> is all the
36+
arguments you want to pass to your application. For example,
37+
38+
If you have version 9.10 of the MATLAB Runtime installed in
39+
/mathworks/home/application/v910, run the shell script as:
40+
41+
./run_VectofilPlus.sh /mathworks/home/application/v910
42+
43+
If you have MATLAB installed in /mathworks/devel/application/matlab,
44+
run the shell script as:
45+
46+
./run_VectofilPlus.sh /mathworks/devel/application/matlab
47+
-MCRInstaller.zip
48+
Note: if end users are unable to download the MATLAB Runtime using the
49+
instructions in the previous section, include it when building your
50+
component by clicking the "Runtime included in package" link in the
51+
Deployment Tool.
52+
-This readme file
53+
54+
55+
56+
3. Definitions
57+
58+
For information on deployment terminology, go to
59+
https://www.mathworks.com/help and select MATLAB Compiler >
60+
Getting Started > About Application Deployment >
61+
Deployment Product Terms in the MathWorks Documentation
62+
Center.
63+
64+
4. Appendix
65+
66+
A. Linux systems:
67+
In the following directions, replace MR/v910 by the directory on the target machine where
68+
MATLAB is installed, or MR by the directory where the MATLAB Runtime is installed.
69+
70+
(1) Set the environment variable XAPPLRESDIR to this value:
71+
72+
MR/v910/X11/app-defaults
73+
74+
75+
(2) If the environment variable LD_LIBRARY_PATH is undefined, set it to the following:
76+
77+
MR/v910/runtime/glnxa64:MR/v910/bin/glnxa64:MR/v910/sys/os/glnxa64:MR/v910/sys/opengl/lib/glnxa64
78+
79+
If it is defined, set it to the following:
80+
81+
${LD_LIBRARY_PATH}:MR/v910/runtime/glnxa64:MR/v910/bin/glnxa64:MR/v910/sys/os/glnxa64:MR/v910/sys/opengl/lib/glnxa64
82+
83+
For more detailed information about setting the MATLAB Runtime paths, see Package and
84+
Distribute in the MATLAB Compiler documentation in the MathWorks Documentation Center.
85+
86+
87+
88+
NOTE: To make these changes persistent after logout on Linux
89+
or Mac machines, modify the .cshrc file to include this
90+
setenv command.
91+
NOTE: The environment variable syntax utilizes forward
92+
slashes (/), delimited by colons (:).
93+
NOTE: When deploying standalone applications, you can
94+
run the shell script file run_VectofilPlus.sh
95+
instead of setting environment variables. See
96+
section 2 "Files to Deploy and Package".
97+
98+
99+
100+
101+
102+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
# script for execution of deployed applications
3+
#
4+
# Sets up the MATLAB Runtime environment for the current $ARCH and executes
5+
# the specified command.
6+
#
7+
exe_name=$0
8+
exe_dir=`dirname "$0"`
9+
echo "------------------------------------------"
10+
if [ "x$1" = "x" ]; then
11+
echo Usage:
12+
echo $0 \<deployedMCRroot\> args
13+
else
14+
echo Setting up environment variables
15+
MCRROOT="$1"
16+
echo ---
17+
LD_LIBRARY_PATH=.:${MCRROOT}/runtime/glnxa64 ;
18+
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/bin/glnxa64 ;
19+
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/os/glnxa64;
20+
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/opengl/lib/glnxa64;
21+
export LD_LIBRARY_PATH;
22+
echo LD_LIBRARY_PATH is ${LD_LIBRARY_PATH};
23+
# Preload glibc_shim in case of RHEL7 variants
24+
test -e /usr/bin/ldd && ldd --version | grep -q "(GNU libc) 2\.17" \
25+
&& export LD_PRELOAD="${MCRROOT}/bin/glnxa64/glibc-2.17_shim.so"
26+
shift 1
27+
args=
28+
while [ $# -gt 0 ]; do
29+
token=$1
30+
args="${args} \"${token}\""
31+
shift
32+
done
33+
eval "\"${exe_dir}/VectofilPlus\"" $args
34+
fi
35+
exit
36+
51 KB
Loading
Loading

doc/Original-Article.pdf

723 KB
Binary file not shown.

doc/Original-Article.pdf.xopp

17.7 KB
Binary file not shown.
1.61 MB
Binary file not shown.

src/API/bvdf_add_noise.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function noisy_img = bvdf_add_noise(image, perc, channel_size, assigned)
2+
noisy_img = image;
3+
4+
% Travel throught every pixel.
5+
for index = 1:size(image, 1)
6+
for jndex = 1:size(image, 2)
7+
8+
% Randomly creating a vector size of channel size.
9+
random_vector = randi(255, channel_size, 1);
10+
11+
% Accoring to percentage, make the interval for each channel.
12+
limit_down = floor(random_vector.*((100-perc)/100));
13+
limit_up = floor(random_vector.*((100+perc)/100));
14+
interval = [limit_down, limit_up];
15+
16+
% Setting the vector negative numbers as 0 (black),
17+
% and the number greater then 255 as 255 (white).
18+
interval(interval < 0) = 0;
19+
interval(interval > 255) = 255;
20+
21+
reshaped_area = reshape(image(index, jndex, :), [], channel_size)';
22+
23+
% Check condition if its in interval for assign noise.
24+
if (min((interval(:, 1) < reshaped_area)) && ...
25+
min(reshaped_area < interval(:, 2)))
26+
noisy_img(index, jndex, :) = assigned;
27+
end
28+
end
29+
end
30+
end

src/API/bvdf_filter.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
function filtered_image = bvdf_filter(image, sample_dims)
2+
% BVDF_FILTER Function to filter the image according the BVDF rule.
3+
if nargin < 2
4+
error("You have to give the image as uint8 matrix, and dimensions of the vectoral process.");
5+
end
6+
7+
color_count = size(image, 3);
8+
image_X = size(image, 1);
9+
image_Y = size(image, 2);
10+
11+
starting_points = [ceil(sample_dims/2), ceil(sample_dims/2)];
12+
choosing_distance = [floor(sample_dims/2), floor(sample_dims/2)];
13+
filtered_image = zeros(image_X, image_Y, color_count);
14+
15+
for x_index = starting_points(1):1:(image_X-starting_points(1))
16+
for y_index = starting_points(2):1:(image_Y-starting_points(2))
17+
18+
area2filter = image(x_index-choosing_distance(1):x_index+choosing_distance(2),...
19+
y_index-choosing_distance(2):y_index+choosing_distance(2), :);
20+
21+
area2filter = im2double(area2filter).*255;
22+
23+
vectors_list = reshape(area2filter , [], 3)';
24+
sorted_vectors = bvdf_sort_vectors(vectors_list);
25+
filtered_image(x_index, y_index, :) = sorted_vectors(:, 1);
26+
end
27+
end
28+
29+
filtered_image = cast(filtered_image, 'uint8');
30+
31+
end

0 commit comments

Comments
 (0)