Ex1 done
parent
0a62f01737
commit
9c61a27d5d
|
@ -11,7 +11,7 @@ def excercise_one() -> None:
|
|||
image = one_a()
|
||||
one_b(image)
|
||||
one_c(image)
|
||||
#one_d(100, 400, 50, 200, image) # needs to be fixed
|
||||
one_d(100, 200, 50, 200, image) # needs to be fixed
|
||||
one_e()
|
||||
|
||||
def one_a() -> npt.NDArray[np.float64]:
|
||||
|
@ -51,15 +51,14 @@ def one_c(image: npt.NDArray[np.float64]) -> None:
|
|||
Question: Why would you use different color maps?
|
||||
Answer:
|
||||
"""
|
||||
print(image.shape)
|
||||
uz.imshow(image[50:200, 100:400, 2], "Just one piece of umbrellas")
|
||||
|
||||
def one_d(startx: int, endx: int, starty: int, endy: int, image:npt.NDArray[np.float64]) -> None:
|
||||
"""
|
||||
(height, width, color)
|
||||
(y , x , color)
|
||||
x ->
|
||||
################# y
|
||||
(x , y , color)
|
||||
y ->
|
||||
################# x
|
||||
# # |
|
||||
# # v
|
||||
# #
|
||||
|
@ -74,8 +73,8 @@ def one_d(startx: int, endx: int, starty: int, endy: int, image:npt.NDArray[np.f
|
|||
"""
|
||||
inverted_image = image.copy()
|
||||
|
||||
for i in range(starty, endx):
|
||||
for j in range(startx, endy):
|
||||
for i in range(startx, endx):
|
||||
for j in range(starty, endy):
|
||||
inverted_image[i, j, 0] = 1 - image[i, j, 0]
|
||||
inverted_image[i, j, 1] = 1 - image[i, j, 1]
|
||||
inverted_image[i, j, 2] = 1 - image[i, j, 2]
|
||||
|
|
Loading…
Reference in New Issue