Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sicom_image_analysis_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Matthieu Muller
sicom_image_analysis_project
Commits
8d24c311
Commit
8d24c311
authored
1 year ago
by
Nathan Lioret
Browse files
Options
Downloads
Patches
Plain Diff
final commit
parent
31795a89
No related branches found
No related tags found
1 merge request
!26
Image Analysis project - Nathan Lioret
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/methods/lioretn/README.txt
+1
-0
1 addition, 0 deletions
src/methods/lioretn/README.txt
src/methods/lioretn/demosaicking.py
+4
-0
4 additions, 0 deletions
src/methods/lioretn/demosaicking.py
src/methods/lioretn/reconstruct.py
+0
-2
0 additions, 2 deletions
src/methods/lioretn/reconstruct.py
with
5 additions
and
2 deletions
src/methods/lioretn/README.txt
0 → 100644
+
1
−
0
View file @
8d24c311
Quite simple to use : reconstruct.py file calls demosaicking.py (where is made the demosaicking) and is called by the main.ipynb
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/methods/lioretn/demosaicking.py
+
4
−
0
View file @
8d24c311
...
@@ -84,11 +84,13 @@ def high_quality_linear_interpolation(op : CFA, y : np.ndarray) -> np.ndarray:
...
@@ -84,11 +84,13 @@ def high_quality_linear_interpolation(op : CFA, y : np.ndarray) -> np.ndarray:
if
mask
[
i
,
j
,
G
]
==
1
:
# We must estimate R and B components
if
mask
[
i
,
j
,
G
]
==
1
:
# We must estimate R and B components
res
[
i
,
j
,
G
]
=
y
[
i
,
j
]
res
[
i
,
j
,
G
]
=
y
[
i
,
j
]
# Estimate R (B at left and right or B at top and bottom)
if
mask
[
i
,
max
(
0
,
j
-
1
),
R
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
R
]
==
1
:
if
mask
[
i
,
max
(
0
,
j
-
1
),
R
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
R
]
==
1
:
res
[
i
,
j
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_r_at_green_rrow_bcol
,
mode
=
'
valid
'
))
res
[
i
,
j
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_r_at_green_rrow_bcol
,
mode
=
'
valid
'
))
else
:
else
:
res
[
i
,
j
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_r_at_green_brow_rcol
,
mode
=
'
valid
'
))
res
[
i
,
j
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_r_at_green_brow_rcol
,
mode
=
'
valid
'
))
# Estimate B (R at left and right or R at top and bottom)
if
mask
[
i
,
max
(
0
,
j
-
1
),
B
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
B
]
==
1
:
if
mask
[
i
,
max
(
0
,
j
-
1
),
B
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
B
]
==
1
:
res
[
i
,
j
,
B
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_b_at_green_brow_rcol
,
mode
=
'
valid
'
))
res
[
i
,
j
,
B
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
2
:
i_pad
+
3
,
j_pad
-
2
:
j_pad
+
3
],
bayer_b_at_green_brow_rcol
,
mode
=
'
valid
'
))
else
:
else
:
...
@@ -114,11 +116,13 @@ def high_quality_linear_interpolation(op : CFA, y : np.ndarray) -> np.ndarray:
...
@@ -114,11 +116,13 @@ def high_quality_linear_interpolation(op : CFA, y : np.ndarray) -> np.ndarray:
if
mask
[
i
,
j
,
G
]
==
1
:
# We must estimate R and B components
if
mask
[
i
,
j
,
G
]
==
1
:
# We must estimate R and B components
res
[
i
:
i
+
2
,
j
:
j
+
2
,
G
]
=
y
[
i
:
i
+
2
,
j
:
j
+
2
]
res
[
i
:
i
+
2
,
j
:
j
+
2
,
G
]
=
y
[
i
:
i
+
2
,
j
:
j
+
2
]
# Estimate R (B at left and right or B at top and bottom)
if
mask
[
i
,
max
(
0
,
j
-
1
),
R
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
R
]
==
1
:
if
mask
[
i
,
max
(
0
,
j
-
1
),
R
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
R
]
==
1
:
res
[
i
:
i
+
2
,
j
:
j
+
2
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_r_at_green_rrow_bcol
,
mode
=
'
valid
'
))
res
[
i
:
i
+
2
,
j
:
j
+
2
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_r_at_green_rrow_bcol
,
mode
=
'
valid
'
))
else
:
else
:
res
[
i
:
i
+
2
,
j
:
j
+
2
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_r_at_green_brow_rcol
,
mode
=
'
valid
'
))
res
[
i
:
i
+
2
,
j
:
j
+
2
,
R
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_r_at_green_brow_rcol
,
mode
=
'
valid
'
))
# Estimate B (R at left and right or R at top and bottom)
if
mask
[
i
,
max
(
0
,
j
-
1
),
B
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
B
]
==
1
:
if
mask
[
i
,
max
(
0
,
j
-
1
),
B
]
==
1
or
mask
[
i
,
min
(
y
.
shape
[
1
]
-
1
,
j
+
1
),
B
]
==
1
:
res
[
i
:
i
+
2
,
j
:
j
+
2
,
B
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_b_at_green_brow_rcol
,
mode
=
'
valid
'
))
res
[
i
:
i
+
2
,
j
:
j
+
2
,
B
]
=
float
(
convolve2d
(
y_pad
[
i_pad
-
4
:
i_pad
+
6
,
j_pad
-
4
:
j_pad
+
6
],
quad_b_at_green_brow_rcol
,
mode
=
'
valid
'
))
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
src/methods/lioretn/reconstruct.py
+
0
−
2
View file @
8d24c311
...
@@ -7,7 +7,6 @@ Students can call their functions (declared in others files of src/methods/your_
...
@@ -7,7 +7,6 @@ Students can call their functions (declared in others files of src/methods/your_
import
numpy
as
np
import
numpy
as
np
from
src.forward_model
import
CFA
from
src.forward_model
import
CFA
from
src.methods.lioretn.demoisaicing_fct
import
High_Quality_Linear_Interpolation
from
src.methods.lioretn.demosaicking
import
high_quality_linear_interpolation
from
src.methods.lioretn.demosaicking
import
high_quality_linear_interpolation
def
run_reconstruction
(
y
:
np
.
ndarray
,
cfa
:
str
)
->
np
.
ndarray
:
def
run_reconstruction
(
y
:
np
.
ndarray
,
cfa
:
str
)
->
np
.
ndarray
:
...
@@ -26,7 +25,6 @@ def run_reconstruction(y: np.ndarray, cfa: str) -> np.ndarray:
...
@@ -26,7 +25,6 @@ def run_reconstruction(y: np.ndarray, cfa: str) -> np.ndarray:
op
=
CFA
(
cfa
,
input_shape
)
op
=
CFA
(
cfa
,
input_shape
)
res
=
high_quality_linear_interpolation
(
op
,
y
)
res
=
high_quality_linear_interpolation
(
op
,
y
)
# res = High_Quality_Linear_Interpolation(op, y)
return
res
return
res
...
...
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