Each pixel from (cols * rows) belongs to either one of the users’ silhouettes in front of the camera (there are no more than 6), or a background. Thus, frame [i] == 0 is the background, and frame [i] == 1…6 is the user’s silhouette.
Sorry for my bad English.
Here [i] is not a user index.
i = cols x rows, this is a big number. For example, when the sensor resolution 640х480 would be 307200 pixels. A user maximum of 6. User index is the value in frame[i], but if this value is 0 it means the pixel [i] does not belong to any of the 6 possible users.
Thus, we will find out if each of the above mentioned 307200 pixels belong to any of the users or background.