Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GEPARD
GEPARD
Commits
70b1c429
Commit
70b1c429
authored
Jul 31, 2020
by
Josef Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blur images in optical scan
parent
c5a3864a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
ramancom/simulatedraman.py
ramancom/simulatedraman.py
+18
-6
No files found.
ramancom/simulatedraman.py
View file @
70b1c429
...
@@ -25,8 +25,10 @@ import sys, os
...
@@ -25,8 +25,10 @@ import sys, os
stdout
=
sys
.
stdout
stdout
=
sys
.
stdout
from
time
import
sleep
from
time
import
sleep
import
numpy
as
np
import
numpy
as
np
import
cv2
from
shutil
import
copyfile
from
shutil
import
copyfile
from
.ramanbase
import
RamanBase
from
.ramanbase
import
RamanBase
from
..helperfunctions
import
cv2imread_fix
,
cv2imwrite_fix
class
SimulatedRaman
(
RamanBase
):
class
SimulatedRaman
(
RamanBase
):
magn
=
20
magn
=
20
...
@@ -38,11 +40,11 @@ class SimulatedRaman(RamanBase):
...
@@ -38,11 +40,11 @@ class SimulatedRaman(RamanBase):
self
.
currentpos
=
None
,
0.
,
0.
self
.
currentpos
=
None
,
0.
,
0.
self
.
currentZ
=
0.
self
.
currentZ
=
0.
# some plausible data to simulate consecutively changing positions
# some plausible data to simulate consecutively changing positions
self
.
positionlist
=
np
.
array
([[
-
1
201
,
13
76
,
-
1290
],
self
.
positionlist
=
np
.
array
([[
-
201
,
8
76
,
-
1290
],
[
-
119
5
,
-
12
00
,
-
1279
],
[
-
5
5
,
-
9
00
,
-
1279
],
[
1097
,
-
12
54
,
-
1297
],
[
1097
,
-
7
54
,
-
1297
],
[
2
7
04.1
,
12
88.2
,
-
1381
],
[
2
0
04.1
,
7
88.2
,
-
1381
],
[
1884.
,
-
1
5
00.8
,
-
1381
]])
[
1884.
,
-
1
0
00.8
,
-
1381
]])
self
.
znum
=
4
self
.
znum
=
4
self
.
gridnum
=
36
self
.
gridnum
=
36
self
.
positionindex
=
0
self
.
positionindex
=
0
...
@@ -95,7 +97,17 @@ class SimulatedRaman(RamanBase):
...
@@ -95,7 +97,17 @@ class SimulatedRaman(RamanBase):
assert
self
.
connected
assert
self
.
connected
cwd
=
os
.
getcwd
()
cwd
=
os
.
getcwd
()
fakeImgPath
=
os
.
path
.
join
(
cwd
,
"gepard"
,
"fakeData/image.bmp"
)
fakeImgPath
=
os
.
path
.
join
(
cwd
,
"gepard"
,
"fakeData/image.bmp"
)
copyfile
(
fakeImgPath
,
fname
)
if
fname
.
endswith
(
'tmp.bmp'
):
copyfile
(
fakeImgPath
,
fname
)
else
:
# fake defocussing
img
:
np
.
ndarray
=
cv2imread_fix
(
fakeImgPath
)
zLevel
:
int
=
int
(
fname
.
split
(
'.bmp'
)[
0
].
split
(
'_'
)[
-
1
])
if
zLevel
>
0
:
blurRad
:
int
=
8
*
zLevel
+
1
# increase and make it odd
self
.
logger
.
info
(
f
'blurring fake image with radius
{
blurRad
}
for z-Level
{
zLevel
}
'
)
img
=
cv2
.
medianBlur
(
img
,
blurRad
)
cv2imwrite_fix
(
fname
,
img
)
self
.
imageindex
=
(
self
.
imageindex
+
1
)
%
(
self
.
znum
*
self
.
gridnum
)
self
.
imageindex
=
(
self
.
imageindex
+
1
)
%
(
self
.
znum
*
self
.
gridnum
)
sleep
(.
01
)
sleep
(.
01
)
...
...
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