I have to loop over a 800 000* 800 000 matrix. I tried to do that by simple loops but it take me so huge time. How can I loop fastly ?
for in in xrange(800000):
for j in xrange(800000):
print i,j
Typically, I am reading an image using OpenCV, then I need to loop over every pixel in order to perform some calculations and comparisons with the values of certain characteristics of the neighbors of the pixel. When I run a loop, I feel it needs more than 2 days to be finished.
In fact, I want to implement my own version of GrowCut algorithm. The authors claim to execute the algorithm in less than 4 minutes using a computer like mine. However, looping over 1200*1100 matrix takes so much time (I tested that). How can I read them quickly ?