1. A method for objects counting, comprising: acquiring a depth image of any one frame; detecting objects according to said depth image wherein said detecting objects according to said depth image comprises: computing a distance from a camera to ground according to said depth image; converting said depth image into a height image starting from the ground according to said distance; performing threshold division on said height image to obtain at least one foreground region set by setting a first threshold and a second threshold for dividing the image, defining regions in the height image of which the height is greater than or equal to said first threshold as first foreground regions, forming said first foreground regions to a first foreground region set, defining regions in the height image of which the height is greater than or equal to said second threshold as second foreground regions, and forming said second foreground regions to a second foreground region set; and identifying objects from said at least one foreground region set according to a preset reference region by selecting at least one foreground region from said first foreground region set and said second foreground region set according to a size and contour of said reference region, defining said selected at least one foreground region as an object, wherein a difference between each of said selected at least one foreground region and said reference region is smaller than or equal to a preset range, whereby when a foreground region from said first foreground set and a foreground region from said second foreground set are at the same position and a difference between each of both foreground regions and said reference region is smaller than or equal to a preset range selecting the foreground region that has the least difference from said reference region and defining said selected foreground region as the object; associating an identical object in different frames to form a trajectory; and determining a number of objects according to the number of trajectories.