I'm developing a project where I should access a pixel from an image and put them in a new RGB array, for this I am using the SFML library, my difficulty is in logic, I know that a pixel is the smallest point of an image and this library gives me access to them through the code:
const sf::Uint8* pixels = imagem.getPixelsPtr();
By the documentation the library stores the pixels in a vector.
What I'm doing is this: knowing the height and width of it, I'm going through a loop and try to get the pixels!
// Descobre o tamanho da imagem
sf::Vector2u tam = imagem.getSize();
int largura = tam.x;
int altura = tam.y;
for(int i = 0; i < largura ; i++)
{
for(int j = 0; j < altura; j++)
{
///METODO DA BIBLIOTECA SFML, PARA ACESSAR O PIXEL.
const sf::Uint8* pixels = imagem.getPixelsPtr();
}
}
How do I convert this image to RGB and put it in another vector?