Answer the question
In order to leave comments, you need to log in
How to reverse a python matrix?
out_gray = cv2.cvtColor(output, cv2.COLOR_BGR2GRAY) # черно-белая матрица картинки type = tuple
out_gray_reverse = [] # реверсированная матрица (объявление)
for i in range(0, len(out_gray) - 1): # перебор первого уровня
for j in range(0, len(out_gray[i]) - 1): # перебор второго уровня
out_gray_reverse[j][i] = out_gray[i][j]
Traceback (most recent call last):
File "img.py", line 64, in <module>
out_gray_reverse[j][i] = out_gray[i][j]
IndexError: list index out of range
len(out_gray) # 131
len(out_gray[0]) # 1026
Answer the question
In order to leave comments, you need to log in
How to reverse
>>> x
array()
>>> x.T
array()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question