Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
inovisao
pynovisao
Commits
9ffcdd0a
Commit
9ffcdd0a
authored
Oct 04, 2018
by
Gilberto Astolfi
Browse files
Merge branch 'correcao-exclusao-imagens'
parents
3b4df001
2789b389
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
src/pynovisao.py
src/pynovisao.py
+2
-1
src/segmentation/skimage_segmenter.py
src/segmentation/skimage_segmenter.py
+1
-1
src/util/file_utils.py
src/util/file_utils.py
+27
-0
No files found.
src/pynovisao.py
View file @
9ffcdd0a
...
...
@@ -550,7 +550,8 @@ class Act(object):
for
idx_segment
in
list_segments
:
segment
,
size_segment
,
idx_segment
=
self
.
segmenter
.
get_segment
(
self
,
idx_segment
=
idx_segment
)[:
-
1
]
filepath
=
File
.
save_class_image
(
segment
,
self
.
dataset
,
tmp
,
self
.
_image_name
,
idx_segment
)
# Problem here! Dataset removed.
filepath
=
File
.
save_only_class_image
(
segment
,
self
.
dataset
,
tmp
,
self
.
_image_name
,
idx_segment
)
len_segments
[
idx_segment
]
=
size_segment
# Perform the feature extraction of all segments in image ( not applied to ConvNets ).
...
...
src/segmentation/skimage_segmenter.py
View file @
9ffcdd0a
...
...
@@ -25,7 +25,7 @@ class SkimageSegmenter(object):
__metaclass__
=
ABCMeta
# flag FORCE_OPT highly increases speed of method paint_segment_skimage but performs a flawed painting
FORCE_OPT
=
Fals
e
FORCE_OPT
=
Tru
e
def
__init__
(
self
,
border_color
=
'Yellow'
,
border_outline
=
'No'
):
"""Constructor.
...
...
src/util/file_utils.py
View file @
9ffcdd0a
...
...
@@ -177,6 +177,33 @@ class File(object):
return
File
.
save_image
(
image
,
File
.
make_path
(
dataset
,
directory
),
filename
+
'_%05d'
%
idx
,
ext
)
@
staticmethod
def
save_only_class_image
(
image
,
dataset
,
directory
,
filename
,
idx
,
ext
=
'.tif'
):
"""Save a class image only.
Parameters
----------
image : opencv image
Image to be saved.
dataset : string
Path do image dataset.
directory : string
Directory where image must be saved.
image : string
Name of image.
image : string
Name of image.
idx : integer
Index of image inside the class.
ext : string, optional, default = '.tif'
Extension which image must be saved in format .ext.
Returns
-------
filepath : string
Return the complete filepath where image was saved.
"""
return
File
.
save_image
(
image
,
File
.
make_path
(
dataset
,
directory
),
filename
+
'_%05d'
%
idx
,
ext
)
@
staticmethod
def
list_dirs
(
dataset
):
"""List all directories inside the dataset.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment