Giter VIP home page Giter VIP logo

Comments (10)

annanurov avatar annanurov commented on August 16, 2024 1

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

from jpg-png-to-mnist-nn-format.

annanurov avatar annanurov commented on August 16, 2024

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])

...?

from jpg-png-to-mnist-nn-format.

nada-raafat avatar nada-raafat commented on August 16, 2024

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

from jpg-png-to-mnist-nn-format.

annanurov avatar annanurov commented on August 16, 2024

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

from jpg-png-to-mnist-nn-format.

soalogy avatar soalogy commented on August 16, 2024

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

from jpg-png-to-mnist-nn-format.

AWellDressedCat avatar AWellDressedCat commented on August 16, 2024

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?

from jpg-png-to-mnist-nn-format.

annanurov avatar annanurov commented on August 16, 2024

Could you please paste the output here?

from jpg-png-to-mnist-nn-format.

ArtemGuy avatar ArtemGuy commented on August 16, 2024

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

from jpg-png-to-mnist-nn-format.

Hamza-ben avatar Hamza-ben commented on August 16, 2024

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)

from jpg-png-to-mnist-nn-format.

ParzifalKali avatar ParzifalKali commented on August 16, 2024

Hi Hamza-ben,
check this link : https://stackoverflow.com/questions/12201577/how-can-i-convert-an-rgb-image-into-grayscale-in-python#12201744

from jpg-png-to-mnist-nn-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.