image = ofImage("0.PNG");
res = ofImage();
res.width = image.getWidth();
res.height = image.getHeight();
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
res.setColor(x, y, ofColor::white);
if (image.getColor(x, y) != ofColor::white) {
res.setColor(x, y, ofColor(0, 0, 0));
cout << ofColor(0, 0, 0).getHex() << ", " << res.getColor(x, y).getHex() << "\n";
}
}
}
[tt]0.PNG[/tt] is an image with white and black parts.
If there’s any [tt]cout[/tt] output then it should output [tt]0, 0[/tt], but instead it’s outputting [tt]0, 16777216[/tt], which suggests that the previous [tt]res.setColor()[/tt] is not working.
How should I fix this code?