could any one explain me the difference between one dimensional for loop and two dimensional for loop. and how could i change following one dimensional for loop to two dimensional for loop on the second snippet code. thank you
i think following is one dimensional for loop
Capture video;
for(int i = 0; i < video.pixels.length; i++){
// encoded so blue is > 0 if a pixel is within threshold
if(blue(video.pixels[i]) > 0){
count++;
// processing takes 0-1 (float) color values from shader to 0-255 (int) values for color
// to decode, we need to divide the color by 255 to get the original value
avg.add(red(video.pixels[i]) / 255.0, green(video.pixels[i]) / 255.0);
}
}
and following snippet code is 2 dimensional for loop
Capture video;
for (int x = 0; x < video.width && x < 100; x++ ) {
for (int y = 240; y < video.height; y++ ) {
int loc = x + y*video.width;
}
}