I'm drawing a pixel by pixel image with the following code:
coord = np.where(np.all(imagen == (0, 0, 0), axis=-1)) cv2.imshow('imagen', imagen) a = coord b = coord for x,y in zip(a,b): rectObs.append(pygame.Rect((y,x),(1,1))) for rect in rectObs: pygame.draw.rect(screen, black, rect,20)
This code detects all the black pixels of an image and draws them in another window with the same coordinate. The problem is that there are so many black pixels that the processing is very very slow.
Any idea to improve performance or to graph in a more optimal (other than pixel by pixel)?