Appending unknown results on list python

I have this python code for finding coordinates for each pixel in an image. I add 1 to y if a column is finished and 1 to x if a row has finished. The data seems fine during the for loop but when accessing the list after it, it has unknown/wrong items.
import cv2
from colormap import rgb2hex

l = []
image = cv2.imread('image.jpg')
size = image.shape
startcord = [423, 117] #Starting coordinate

rows = size[0] #100
cols = size[1] #100

for i in range(rows):
for j in range(cols):
r, g, b = int(image[i, j, 2]), int(image[i, j, 1]), int(image[i, j, 0])

if r >= 250 and g >= 250 and b >= 250:
pass

else:
hexVal = rgb2hex(r, g, b)
data = (startcord, hexVal, i, j)
print(data) #This gives the right values
l.append(data)

startcord[1] += 1

startcord[1] = 117
startcord[0] += 1

print(l) #When opening, gives unknown/wrong items

I don't know what's wrong, any help is appreciated.
 

Austin

Schismatic
is a Programmeris a Community Contributoris a Forum Moderator Alumnusis a Battle Simulator Moderator Alumnus
Do you have an actual link to your project? Linking a Python training website doesn't really help
 
Could you give an example of what the output looks like. Especially the prints.

Also, could you put the proper indenting in the code. Maybe using the code tags, or use spaces instead of tabs (or put it in a pastebin and link it)
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top