Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
python3-imagej-tiff
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
python3-imagej-tiff
Commits
6f404273
Commit
6f404273
authored
Aug 21, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing weights displaying for WLOSS_LAMBDA
parent
364684d5
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
80 deletions
+126
-80
nn_ds_neibs1_tmp.py
nn_ds_neibs1_tmp.py
+121
-31
numpy_visualize_weights.py
numpy_visualize_weights.py
+5
-49
No files found.
nn_ds_neibs1_tmp.py
View file @
6f404273
This diff is collapsed.
Click to expand it.
numpy_
image_test
.py
→
numpy_
visualize_weights
.py
View file @
6f404273
...
...
@@ -4,10 +4,6 @@ import numpy as np
import
matplotlib.pyplot
as
plt
import
math
def
hamming_window
(
x
,
N
):
y
=
0.2
-
0.46
*
math
.
cos
(
2
*
math
.
pi
*
x
/
(
N
-
1
))
return
y
# input: np.array(a,b) - 1 channel
# output: np.array(a,b,3) - 3 color channels
def
coldmap
(
img
,
zero_span
=
0.2
):
...
...
@@ -59,7 +55,7 @@ def tiles(img,shape,tiles_per_line=1,borders=True):
inner_color
=
[
img_max
/
4
,
img_max
/
4
,
img_min
]
inner_color
=
[
img_min
,
img_min
,
img_min
]
inner_color
=
[
img_max
,
img_max
,
img_min
]
#
inner_color = [img_max,img_max,img_min]
group_h
=
shape
[
0
]
group_w
=
shape
[
1
]
...
...
@@ -141,52 +137,12 @@ def tiles(img,shape,tiles_per_line=1,borders=True):
return
out
if
__name__
==
"__main__"
:
#
hw
=
hamming_window
#
image
=
np
.
array
([[
1
*
hw
(
i
,
512
)
*
hw
(
j
,
512
)
for
i
in
range
(
512
)]
for
j
in
range
(
512
)],
np
.
float32
)
zeros
=
np
.
zeros
((
512
,
512
))
# 32x324
#image2 = np.zeros((32,324))
#rgb_img_0 = tiles(image2,(1,4,9,9),tiles_per_line=2,borders=True)
#image2 = np.zeros((32,144))
image2
=
np
.
array
([[
1
*
hw
(
i
,
144
)
*
hw
(
j
,
32
)
for
i
in
range
(
144
)]
for
j
in
range
(
32
)],
np
.
float32
)
#image3 = coldmap(image2)
rgb_img_0
=
tiles
(
coldmap
(
image2
),(
3
,
3
,
4
,
4
),
tiles_per_line
=
8
,
borders
=
True
)
#image = np.zeros((32,144))
image
=
np
.
random
.
rand
(
32
,
144
)
rgb_img_0
=
tiles
(
coldmap
(
image
),(
3
,
3
,
4
,
4
),
tiles_per_line
=
8
,
borders
=
True
)
fig
=
plt
.
figure
()
fig
.
suptitle
(
"
HaWi
"
)
fig
.
suptitle
(
"
Test
"
)
plt
.
imshow
(
rgb_img_0
)
rgb_img
=
coldmap
(
image
)
#print(rgb_img)
'''
for i in range(512):
for j in range(512):
if image[i,j]<0:
rgb_img[i,j,0] = 0
rgb_img[i,j,1] = 0
#rgb_img[i,j,2] = 255
if image[i,j]>0:
#rgb_img[i,j,0] = 255
rgb_img[i,j,1] = 0
rgb_img[i,j,2] = 0
if image[i,j]==0:
rgb_img[i,j,0] = 0
rgb_img[i,j,1] = 255
rgb_img[i,j,2] = 0
'''
print
(
rgb_img
.
shape
)
fig
=
plt
.
figure
()
fig
.
suptitle
(
"HamWindow"
)
plt
.
imshow
(
rgb_img
)
#plt.colorbar()
plt
.
show
()
\ No newline at end of file
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