Hi, it seems that you are getting an unknown pixel type from your camera. Which camera are you using? are you using with it an addon? the pixel type of the ofPixels object that the cam object returns has an unknown pixel type which finally leads to the crash.
you could also access the raw pixel data and extract color info from there.
Why were you allocating the ofPixels object? that is done internally by the camera grabber.
Are you doing anything else with the ofPixels object anywhere else?
As of the confusion that you have, OF_IMAGE_COLOR is for ofImage objects and OF_PIXELS_RGB and is for ofPixels objects. It’s quite straight forwards. Although, the ofImage class contains an ofPixels instance, which might be what generates the confusion.
best
OK, that makes sense, the IMAGE and the PIXELS … maybe COLOR and RGB confused me … anyway, oF is definitely much more complex and complicated than Processing! But yes, it’s also much more powerful.
Ah, ok, so I don’t need to allocate ofPixels in setup? Unlike ofTexture?
Usually I’m only loading ofPixels into a texture to draw it. But sometimes I need to get the pixels from it somewhere else in the code. But I’m still trying to figure out all the differences between ofPixels, ofTextures and ofImage …
If you are getting the ofPixels from somewhere else (like cam.getPixels()) theres no need to allocate them as you will get a copy of the pixels inside the cam object. Kind of the same goes for ofTextures.
take a look at this. It might be useful.
BTW, read it in github so it gets rendered correctly.