A computer-implemented method to determine the dimensions (a, b, c) and distance (D1, D2) of a number of objects (O1, O2) in an environment comprising the steps: - providing a number of objects (O1, O2), each comprising a marking element (M1, M2), in the environment, - recording a visual image-dataset of at least one of the number of objects (O1, O2) with a camera, wherein in the course of recording a visual image-dataset, an image with different focus points is recorded, - determining a parameter value from the image of a marking element (M1 i, M2 i) in the image-dataset, wherein the parameter value is a value depending on the distance (D1, D2) of an object of the number of objects (O1, O2) each comprising a marking element (M1, M2) to the camera, - calculating the relative distance between the object (O1, O2) and the camera based on this parameter value, - calculating dimensions (a, b, c) of the object (O1, O2) from at least a part of the image of the object (O1, O2) in the image-dataset and the calculated distance (D1, D2), wherein the dimensions (a, b, c) of the object (O1, O2) is determined by - slicing the area around a marking element (M1, M2) wherein the slices comprise images recorded with different focus points, and - observing the depth of the recorded light field and/or the sharpness of the image in the slices and calculating image-dimensions of the image of the object (O1, O2) based on the depth of the recorded light field and/or the sharpness of the image, - determining the dimensions (a, b, c) of the object (O1, O2) based on the image- dimensions of the image of the object (O1, O2), the dimensions of the marking element (M1, M2) and the known values of a focusing optic of the camera. - providing a number of objects (O1, O2), each comprising a marking element (M1, M2), in the environment, - recording a visual image-dataset of at least one of the number of objects (O1, O2) with a camera, wherein in the course of recording a visual image-dataset, an image with different focus points is recorded, - determining a parameter value from the image of a marking element (M1 i, M2 i) in the image-dataset, wherein the parameter value is a value depending on the distance (D1, D2) of an object of the number of objects (O1, O2) each comprising a marking element (M1, M2) to the camera, - calculating the relative distance between the object (O1, O2) and the camera based on this parameter value, - calculating dimensions (a, b, c) of the object (O1, O2) from at least a part of the image of the object (O1, O2) in the image-dataset and the calculated distance (D1, D2), - slicing the area around a marking element (M1, M2) wherein the slices comprise images recorded with different focus points, and - observing the depth of the recorded light field and/or the sharpness of the image in the slices and calculating image-dimensions of the image of the object (O1, O2) based on the depth of the recorded light field and/or the sharpness of the image, - determining the dimensions (a, b, c) of the object (O1, O2) based on the image- dimensions of the image of the object (O1, O2), the dimensions of the marking element (M1, M2) and the known values of a focusing optic of the camera.