Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98689668
Anchor_image_computation.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jan 15, 16:07
Size
617 B
Mime Type
text/x-python
Expires
Fri, Jan 17, 16:07 (2 d)
Engine
blob
Format
Raw Data
Handle
23628917
Attached To
R11789 DED Contrastive Learning
Anchor_image_computation.py
View Options
#%%
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
PIL
import
Image
import
glob
#%%
path
=
...
\
Data
\
..
# use your path
all_files
=
glob
.
glob
(
path
+
"/*.png"
)
ims
=
[]
for
filename
in
all_files
:
print
(
filename
)
ims
.
append
(
Image
.
open
(
filename
,
mode
=
'r'
))
ims
=
np
.
array
([
np
.
array
(
im
)
for
im
in
ims
])
imave
=
np
.
average
(
ims
,
axis
=
0
)
print
(
imave
.
shape
)
result
=
Image
.
fromarray
(
imave
.
astype
(
'uint8'
))
result
.
save
(
'C:/Users/srpv/Desktop/C4 Science/DED Contrastive Learning/Semi supervised/Data/Anchor/Normal/result.png'
)
plt
.
figure
(
figsize
=
(
20
,
4
))
plt
.
imshow
(
np
.
transpose
(
result
,
(
0
,
1
,
2
)))
Event Timeline
Log In to Comment