12-10-2012 12:24 PM - edited 12-10-2012 12:24 PM
More vague advice, normally I give this one to text programmers: Avoid using idioms until you are really comfortable with reading them. += in one of may favorites but perhaps you are not expanding it in your mind as you are reading the code. Trace your filtering loops through the first two points and pay close attention to what is going on at the start of the second point.
12-11-2012 06:29 AM
Stin0 wrote:thanks for pointing that out for me, so I connect the 'totalpix' array with the 'colors' array from the image data instead of the 'image' array, that's correct right?
No, this is not correct. The "image" array contains the indexes of the "colors" array elements. So for each pixel, you need to find the index in the "image" array, then extract the color value from the "colors" array at the right index.
The "colors" array contains 32bit integers representing the RGB color. First byte is 0, second byte is red, third byte is green and last byte is blue.
Did you look at the Help page of the "Read BMP File VI" ? This is clearly explained!
12-18-2012 04:55 AM
yeah i did read the help page and i read it over and over again but i couldn't understand, thanks for your tips but i think i'm just not made for this programming **bleep**, i'm giving up, it's never gonna work, thanks for your help
12-18-2012 06:31 AM
Hey Stin0,
What didn't you understand? I think I explained you clearly how to do it in my last post, isn't it?
Here is an example to extract the red value of the pixel i:
rgb = colors[image[i]]; // retrieve the index out of the image array to extract the right color from the colors array
red = (rgb>>8) & 0xff; // take the second byte which corresponds to red
Also, what Darin.K wanted to point you out is that you forgot to reset your pixel value for each new pixel. Do you understand why? Do you know what the operation "+=" does exactly?
Do not give up, you are close to a working solution.