Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ajsgolf27

Pages: [1]
1
Graphics / Re: Help with getpixelptr()
« on: June 10, 2014, 04:07:41 pm »
I figured it out! If I take out all the cout's it's takes seconds it was a stupid mistake.

2
Graphics / Re: Help with getpixelptr()
« on: June 10, 2014, 02:05:05 pm »
Exactly I am so glad you agree this is driving me crazy! I am probably missing something small, i am new to sfml.
Image myImage;
if (!myImage.loadFromFile("cone_nebula/cone_nebula_001.png")){
                return -1;
        }
              Texture texture;
              Sprite sprite;
              texture.loadFromImage(myImage);

              vector <int> pixelValues;

        x = myImage.getSize().x;
        y = myImage.getSize().y;

        cout << x << "," << y << endl;
       
        for (int i = 0; i < x; i++){
               
                for (int j = 0; j < y; j++){

                        const Color color = myImage.getPixel(i, j);
                        pixelValues.push_back((int)color.r);
                        cout << (int)color.r << endl;
                        cout << (int)color.b << endl;
                        cout << (int)color.g << endl;

                        cout <<"these are red pixels in array " << pixelValues[z++]  << "   " << z << endl;
                       
                }
               
        }
 

3
Graphics / Re: Help with getpixelptr()
« on: June 10, 2014, 07:56:23 am »
I've tried that and my image that I'm working with is 600 x 600 pixels it took 35 min to run the code unless my computer is just too slow

4
Graphics / Help with getpixelptr()
« on: June 10, 2014, 07:20:43 am »
Hi I am having a hard time setting up my pixel pointer to an array where I can modify pixels and eventually use the create function to display back to the window.

I understand the first part in the documentation where I wrote this:

const Uint8* pixels = myImage.getPixelsPtr();

I also understand that it's going to return the values in groups of 4.
So how would I turn this into an array I can modify? Any help is greatly appreciated  thanks in advance.

5
Graphics / Re: getpixel() not assigning the RGBA value properly
« on: June 10, 2014, 01:19:44 am »
I'm not entirely sure if that will achieve what I am looking for but it's worth a try thanks for you help!

6
Graphics / Re: getpixel() not assigning the RGBA value properly
« on: June 09, 2014, 11:46:05 pm »
In my loop I went through every pixel in my image and retrieved the red blue and green. I need to do that for every image and from there I need to take the same pixel lets say myImage1[0][0], myImage2[0][0] average them and put into an new array and display the new image

7
Graphics / Re: getpixel() not assigning the RGBA value properly
« on: June 09, 2014, 11:16:49 pm »
Sorry I didn't specify the goal here but I'm trying to get the red , green and blue values for a set of images and save them to arrays.

8
Graphics / Re: getpixel() not assigning the RGBA value properly
« on: June 09, 2014, 10:26:01 pm »
Thank you! I think this is going to take a really long time would there be a faster way?

9
Graphics / getpixel() not assigning the RGBA value properly
« on: June 09, 2014, 09:37:47 pm »
I am trying to add the red pixel values into a vector, but when I print out the vector its empty. The color value prints correctly as the loop goes so its getting the values from the pixels. Also this is extremely slow would there be a better way to do this? I am still a student so any help would be greatly appreciated.

vector <Uint8> pixelValues;
        x = myImage.getSize().x;
        y = myImage.getSize().y;
        for (Uint8 i = 0; i < x; i++){
               
                for (Uint8 j = 0; j < y; j++){

                        const Color color = myImage.getPixel(i, j);
                        pixelValues.push_back((Uint8)color.r);
                        cout << (int)color.r << endl;
                        cout << (int)color.b << endl;
                        cout << (int)color.g << endl;
                        cout <<"these are red pixels in array " << pixelValues[z++] << endl;
                }
      

Pages: [1]
anything