上传文件至 /
This commit is contained in:
34
260416-2509165027.py
Normal file
34
260416-2509165027.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#练习1----------
|
||||
import numpy as np
|
||||
image=np.array([
|
||||
[100,150, 200],
|
||||
[80, 120, 180],
|
||||
[60, 90, 140]
|
||||
],dtype=np.uint8)
|
||||
print("原图:")
|
||||
print(image)
|
||||
darker=image-20
|
||||
print(darker)
|
||||
top_left=image[0:2, 0:2]
|
||||
print(top_left)
|
||||
flipped=np.fliplr(image)
|
||||
print(flipped)
|
||||
#练习2-----------
|
||||
import numpy as np
|
||||
image=np.array([
|
||||
[255, 255, 0, 0],
|
||||
[255, 255, 0, 0],
|
||||
[ 0, 0, 255, 255],
|
||||
[ 0, 0, 255, 255]
|
||||
],dtype=np.uint8)
|
||||
|
||||
#练习3-----------
|
||||
import numpy as np
|
||||
feature_map1=np.array([[1, 0, 1], [0, 1, 0], [1, 0, 1]])
|
||||
feature_map2=np.array([[1, 1, 1], [1, 0, 0], [1, 0, 0]])
|
||||
|
||||
vector1=feature_map1.flatten()
|
||||
vector2=feature_map2.flatten()
|
||||
|
||||
print("vector1", vector1)
|
||||
print("vector2", vector2)
|
||||
Reference in New Issue
Block a user