Issue
I have a 2D binary video with a value of 0 or 255. I would like to find the pixels with a value of 255 in a specific range of rows and columns in each image and plot the column value of them continuously. I found the rows (x values) and columns (y values) of pixels with a value of 255 in the following program, however I cannot create a list of rows and a list of columns separately to plot the column values continuously. Please find below my program.
for row in range(0,700):
for column in range(354):
if thresh[row][column]==255:
print(row,column)
Could you please help me to create a list of row values and column values separately and plot them continuously using matplotlib?
Solution
Let's use a simple matrix as an example:
A = [[1, 255, 5],
[-5, 8, 9]]
The objective is to print indices with a value of 255.
for i in range(len(A)):
for j in range(len(A[i])):
if A[i][j]==255:
print(i,j)
Which returns 0 1
in this case.
Answered By - Mahdiar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.