If you are going to add data from several lines to video frames, then you need to add several lines to the putText () method, even if the above answer with a for loop does not work .
What you can do is use the "exec" function in python, which will take a string as input and display it in code.
Therefore, I suggest creating a small piece of Python code as a string, adding all the lines using the for loop, and execute it in the place you want, and it will also be displayed in different places. This case helped me add data to the video.
stringexec = "" m=0 for i in TextList: stringexec = steval+"cv2.putText(frame, TextList[" + str(TextList.index(i))+"], (100, 100+"+str(m)+"), cv2.FONT_HERSHEY_COMPLEX, 0.5, (200, 100, 100), 1, cv2.LINE_AA)\n" m += 100 exec(stringexec)
Sheetansh kumar
source share