Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.ip.qualitymeasure
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.ip.qualitymeasure
Commits
5aef3237
Commit
5aef3237
authored
Jul 13, 2017
by
David GEISSBUHLER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python version of tan_specular_highlights removed.
parent
bf366952
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
846 deletions
+10
-846
bob/ip/qualitymeasure/__init__.py
bob/ip/qualitymeasure/__init__.py
+0
-2
bob/ip/qualitymeasure/msu_iqa_features.py
bob/ip/qualitymeasure/msu_iqa_features.py
+0
-2
bob/ip/qualitymeasure/script/highlights_histogram.py
bob/ip/qualitymeasure/script/highlights_histogram.py
+9
-26
bob/ip/qualitymeasure/script/remove_highlights.py
bob/ip/qualitymeasure/script/remove_highlights.py
+1
-18
bob/ip/qualitymeasure/tan_specular_highlights.py
bob/ip/qualitymeasure/tan_specular_highlights.py
+0
-798
No files found.
bob/ip/qualitymeasure/__init__.py
View file @
5aef3237
...
...
@@ -5,8 +5,6 @@ from .galbally_iqm_features import compute_quality_features
from
.msu_iqa_features
import
compute_msu_iqa_features
from
._library
import
remove_highlights
from
.
import
tan_specular_highlights
as
tsh
def
get_config
():
"""
...
...
bob/ip/qualitymeasure/msu_iqa_features.py
View file @
5aef3237
...
...
@@ -10,12 +10,10 @@ import bob.ip.base
import
bob.ip.color
from
.
import
galbally_iqm_features
as
iqm
#from . import tan_specular_highlights as tsh
from
._library
import
remove_highlights
''' Utility functions '''
def
matlab_rgb2hsv
(
rgbImage
):
# first normalize the range of values to 0-1
...
...
bob/ip/qualitymeasure/script/highlights_histogram.py
View file @
5aef3237
...
...
@@ -5,6 +5,8 @@
Created on 28 Jun 2017
@author: dgeissbuhler
Compute average specular histogram of an entire picture folder.
'''
from
__future__
import
print_function
...
...
@@ -13,21 +15,15 @@ import sys
import
argparse
import
time
import
bob.io.base
import
bob.io.image
import
bob.io.video
import
bob.ip.base
import
numpy
as
np
from
bob.ip.qualitymeasure
import
remove_highlights_orig
from
bob.ip.qualitymeasure
import
remove_highlights
from
bob.ip.qualitymeasure
import
tsh
def
main
(
command_line_parameters
=
None
):
"""Remove the specular component of the input image and write result to
a file.
"""
argParser
=
argparse
.
ArgumentParser
(
description
=
__doc__
,
...
...
@@ -44,17 +40,15 @@ def main(command_line_parameters=None):
'--output'
,
dest
=
'output'
,
default
=
None
,
help
=
'output file.'
)
help
=
'output
text
file.'
)
args
=
argParser
.
parse_args
(
command_line_parameters
)
num_hist
=
0.0
hist_v0
=
np
.
zeros
(
256
,
dtype
=
'uint64'
)
hist_v1
=
np
.
zeros
(
256
,
dtype
=
'uint64'
)
hist_v2
=
np
.
zeros
(
256
,
dtype
=
'uint64'
)
hist
=
np
.
zeros
(
256
,
dtype
=
'uint64'
)
f
=
open
(
args
.
output
,
'w'
)
print
(
'# i
v0 v1 v2
'
,
file
=
f
)
print
(
'# i
bin_value
'
,
file
=
f
)
# 1. open input image
print
(
"Opening dir: %s"
%
args
.
path
)
...
...
@@ -63,35 +57,24 @@ def main(command_line_parameters=None):
# 2. compute
for
file
in
files
:
print
(
'processing file: %s'
%
file
)
video
=
bob
.
io
.
video
.
reader
(
args
.
path
+
file
)
frame
=
video
[
0
]
sfi
,
diff
,
residue
=
tsh
.
remove_highlights
(
frame
.
astype
(
np
.
float32
),
0.06
)
residue
[
np
.
where
(
np
.
isinf
(
residue
))]
=
0
residue
[
np
.
where
(
np
.
isnan
(
residue
))]
=
0
residue
[
np
.
where
(
residue
<
0
)]
=
0
residue
[
np
.
where
(
residue
>
255
)]
=
255
hist_v0
=
hist_v0
+
bob
.
ip
.
base
.
histogram
(
residue
[
0
],
(
0.0
,
255.0
),
256
)
sfi
,
diff
,
residue
=
remove_highlights
(
frame
.
astype
(
np
.
float32
),
0.06
)
sfi
,
diff
,
residue
=
remove_highlights_orig
(
frame
.
astype
(
np
.
float32
),
0.06
)
residue
[
np
.
where
(
np
.
isinf
(
residue
))]
=
0
residue
[
np
.
where
(
np
.
isnan
(
residue
))]
=
0
residue
[
np
.
where
(
residue
<
0
)]
=
0
residue
[
np
.
where
(
residue
>
255
)]
=
255
hist_v1
=
hist_v1
+
bob
.
ip
.
base
.
histogram
(
residue
[
0
],
(
0.0
,
255.0
),
256
)
sfi
,
diff
,
residue
=
remove_highlights
(
frame
.
astype
(
np
.
float32
),
0.06
)
residue
[
np
.
where
(
np
.
isinf
(
residue
))]
=
0
residue
[
np
.
where
(
np
.
isnan
(
residue
))]
=
0
residue
[
np
.
where
(
residue
<
0
)]
=
0
residue
[
np
.
where
(
residue
>
255
)]
=
255
hist_v2
=
hist_v2
+
bob
.
ip
.
base
.
histogram
(
residue
[
0
],
(
0.0
,
255.0
),
256
)
hist
=
hist
+
bob
.
ip
.
base
.
histogram
(
residue
[
0
],
(
0.0
,
255.0
),
256
)
# 1. save output image
for
i
in
range
(
256
):
print
(
i
,
hist
_v0
[
i
],
hist_v1
[
i
],
hist_v2
[
i
],
file
=
f
)
print
(
i
,
hist
[
i
],
file
=
f
)
...
...
bob/ip/qualitymeasure/script/remove_highlights.py
View file @
5aef3237
...
...
@@ -15,9 +15,7 @@ import bob.io.base
import
bob.io.image
import
numpy
as
np
from
bob.ip.qualitymeasure
import
remove_highlights_orig
from
bob.ip.qualitymeasure
import
remove_highlights
from
bob.ip.qualitymeasure
import
tsh
def
main
(
command_line_parameters
=
None
):
"""Remove the specular component of the input image and write result to
...
...
@@ -55,13 +53,6 @@ def main(command_line_parameters=None):
default
=
0.5
,
help
=
'value of epsilon parameter.'
)
argParser
.
add_argument
(
'-a'
,
'--algorithm'
,
dest
=
'algorithm'
,
default
=
0
,
help
=
'version of the algoritm used.'
)
args
=
argParser
.
parse_args
(
command_line_parameters
)
if
not
args
.
inpImg
:
...
...
@@ -76,15 +67,7 @@ def main(command_line_parameters=None):
# 2. compute
print
(
"Extracting diffuse component..."
)
if
int
(
args
.
algorithm
)
==
0
:
print
(
'v0'
)
sfi
,
diff
,
residue
=
tsh
.
remove_highlights
(
img
.
astype
(
np
.
float32
),
float
(
args
.
epsilon
))
elif
int
(
args
.
algorithm
)
==
1
:
print
(
'v1'
)
sfi
,
diff
,
residue
=
remove_highlights_orig
(
img
.
astype
(
np
.
float32
),
float
(
args
.
epsilon
))
else
:
print
(
'v2'
)
sfi
,
diff
,
residue
=
remove_highlights
(
img
.
astype
(
np
.
float32
),
float
(
args
.
epsilon
))
sfi
,
diff
,
residue
=
remove_highlights
(
img
.
astype
(
np
.
float32
),
float
(
args
.
epsilon
))
# 1. save output image
print
(
"Saving output file: %s"
%
args
.
outImg
)
...
...
bob/ip/qualitymeasure/tan_specular_highlights.py
deleted
100644 → 0
View file @
bf366952
This diff is collapsed.
Click to expand it.
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