Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Computer Vision Group 10
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Wighus Holtmon
Computer Vision Group 10
Commits
6e56a00d
Commit
6e56a00d
authored
4 years ago
by
Leonardo de Lima Gaspar
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
cbed16e7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sobel filter analysis/mainAmund.m
+68
-0
68 additions, 0 deletions
sobel filter analysis/mainAmund.m
with
68 additions
and
0 deletions
sobel filter analysis/mainAmund.m
0 → 100644
+
68
−
0
View file @
6e56a00d
% Will go through all files in a folder and get the file path to all files given a file extension.
% Source: https://matlab.fandom.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
% Specify the folder where the files live.
myFolder
=
uigetdir
;
excel_file
=
'GroundTruth.xlsx'
;
T
=
readtable
(
excel_file
);
%% Do the algorythm over all test images
num_test
=
202
;
distance
=
300
;
% Check to make sure that folder actually exists. Warn user if it doesn't.
if
~
isfolder
(
myFolder
)
errorMessage
=
sprintf
(
'Error: The following folder does not exist:\n%s\nPlease specify a new folder.'
,
myFolder
);
uiwait
(
warndlg
(
errorMessage
));
myFolder
=
uigetdir
();
% Ask for a new one.
if
myFolder
==
0
% User clicked Cancel
return
;
end
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern
=
fullfile
(
myFolder
,
'*.jpg'
);
% Change to whatever pattern you need.
theFiles
=
dir
(
filePattern
);
% Just make sure user have not typed too large of num_test
if
num_test
>
length
(
theFiles
)
num_test
=
length
(
theFiles
);
errorMessage
=
sprintf
(
'Error: It appears that your specified num is larger than the number of images in the folder.'
);
uiwait
(
warndlg
(
errorMessage
));
end
ratios
=
zeros
(
1
,
num_test
);
% empty list. Is going to be used to store the ratios of overlaps
successRates
=
zeros
(
1
,
num_test
);
% Loop through the images and do whatever
for
k
=
1
:
num_test
baseFileName
=
theFiles
(
k
)
.
name
;
fullFileName
=
fullfile
(
theFiles
(
k
)
.
folder
,
baseFileName
);
% Path to image
fprintf
(
1
,
'Now reading %s\n'
,
baseFileName
);
img
=
imread
(
fullFileName
);
% Do what ever you want to the image here
% ----
[
img_proc
,
img_box
]
=
detectFish
(
img
);
% find the corresponding box for that image in marius' excel file:
m_box_x1
=
T
.
Var4
(
k
);
m_box_x2
=
T
.
Var5
(
k
);
m_box_y1
=
T
.
Var2
(
k
);
m_box_y2
=
T
.
Var3
(
k
);
m_box
=
[
m_box_x1
,
m_box_y1
,
m_box_x2
-
m_box_x1
,
m_box_y2
-
m_box_y1
];
ratios
(
k
)
=
bboxOverlapRatio
(
img_box
,
m_box
);
% replace one of the 'img_box' with Marius' box
overlap_ratio
=
ratios
(
1
,
k
);
% just print the overlap value for this image to screen
if
ratios
(
1
,
k
)
>=
0.55
% everything over 0.7 is concidered good enough - a success
successRates
(
1
,
k
)
=
1
;
else
successRates
(
1
,
k
)
=
0
;
end
img_proc
=
insertShape
(
img_proc
,
'FilledRectangle'
,
m_box
,
'Color'
,
'green'
);
% insert Marius' rectangle into output image
%figure,
%subplot(1,2,1), imshow(img), title('original');
%subplot(1,2,2), imshow(img_proc), title('processed');
% ---
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment