<div dir="ltr">Hello everyone, <div><br></div><div style>I have this part of my code where I am trying to traverse over an image by running a for loop for both x and y co-ordinate axis. But the loop is terminating by just reading first pixel. Can think of a reason why this is happening ?</div>
<div style><br></div><div style>The code is: </div><div style><div>for sy in xrange(0, segimage.height):</div><div> for sx in xrange(0, segimage.width):</div><div> if segimage[sy,sx] == (0.0, 0.0, 0.0):</div>
<div> continue</div><div> else:</div><div> seg_color = segimage[sy,sx]</div><div> blue = int(seg_color[0])</div><div> green = int(seg_color[1])</div><div>
red = int(seg_color[2])</div><div> reg_num = blue + 256 * green + 65536 * red</div><div> for l in f:</div><div> sp = l.split(",")</div><div> if len(sp) == 14:</div>
<div> print sy, sx # for checking which pixel its reading currently</div><div> print reg_num, sp[0] # for checking whats happening </div><div> if reg_num == int(sp[0].strip()):</div>
<div> print reg_num, sp[0].strip() # for checking whats happening</div><div> classification = int(sp[13].strip())</div><div> </div><div><br>
</div><div style>The inside "for loop" is for reading a csv format file from which I am extracting some information. </div><div style><br></div><div style>Thanks in Advance for your suggestions</div><div style><br>
</div><div> </div><div><br></div></div></div>