Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please how correct the Error (python V 3.5) #10

Open
nada-raafat opened this issue Apr 29, 2017 · 10 comments
Open

please how correct the Error (python V 3.5) #10

nada-raafat opened this issue Apr 29, 2017 · 10 comments

Comments

@nada-raafat
Copy link

data_image.append(pixel[y, x])

TypeError: an integer is required (got type tuple)

thank you very much for your help .

@annanurov
Copy link

If youare working with grayscale images, all color values are same.
try
data_image.append(pixel[y, x] [0])

@annanurov
Copy link

annanurov commented Jun 2, 2017

Or maybe copy the line three times:
data_image.append(pixel[y, x] [0])
data_image.append(pixel[y, x] [1])
data_image.append(pixel[y, x] [2])

...?

@nada-raafat
Copy link
Author

thank you for replay
but that error happen
data_image.append(pixel[y, x][0])
IndexError: image index out of range

@annanurov
Copy link

annanurov commented Jun 5, 2017

Check previous lines in your code: pixel is empty if the image is not loaded.
Make sure that the image loads properly.

@soalogy
Copy link

soalogy commented Jun 9, 2017

If you are using RGB image, you might need to convert them to gray scale image. Try print(pixel[x,y]). It needs to be an integer I think

@AWellDressedCat
Copy link

I attempted data_image.append(pixel[y,x][0])
but received the error "TypeError: 'int' object has no attribute 'getitem'"
When I print pixel[0,0] I get a long string of numbers rather than a single integer, which is what I believe I'm trying to get. Does anyone have any suggestions?

@annanurov
Copy link

Could you please paste the output here?

@ArtemGuy
Copy link

ArtemGuy commented Mar 6, 2018

thankyou for question. i solve my problem - just convert rgb to grayscale and it's ok

@Hamza-ben
Copy link

Hi ArtemGuy
i have the same problem and i didn't understand how did you convert rgb to grayscale.
could you help me?

File "convert-images-to-mnist-cats-dogs.py", line 40, in
data_image.append(pixel[y,x])
TypeError: an integer is required (got type tuple)

@ParzifalKali
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants