A method in a mobile device for optically detecting and localizing a two-dimensional, 2D, marker in 2D scene data, comprising the steps of: a) providing 2D scene data in form of a digital image; b) thresholding the provided image into a binary black and white image while processing it to detect contiguous areas within the image; c) sequential labelling of objects in the binary image in order to find connected components, wherein in a single pass of the image every pixel is labelled as either belonging to the background or a foreground object with unique ID; and d) linearly analyzing said contiguous areas to determine whether they are a marker, wherein step d) comprises a step of calculating the Euler number of white areas in the thresholded binary image, the method further comprising the steps of comparing the calculated Euler numbers of the white areas with the given Euler number of the marker to be detected and discarding those white areas whose Euler number does match with the given Euler number; e) detecting the corners of contiguous areas within the image whose Euler number matches with the given Euler number; f) estimating hidden corners, comprising the steps of: 1) choosing two end points amongst consecutive pairs of detected comers; 2) collecting a sample of points along the marker boundary between the two end points; 3) estimating the parameters of two line candidates; 4) assigning to each line its member points amongst the sampled points, wherein every point belongs to that line to which it is nearest, thereby obtaining two sets of member points; 5) for each of the two sets of member points, refitting a line to estimate the line they lie on, wherein the two lines correspond to estimates of the marker edges; and 6) repeating steps 4) and 5) until convergence; g) repeating previous steps 1)-6) clockwise until four valid corners are found; the method further comprising a step of constantly updating the threshold, wherein the marker position in the previous frame of the digital image is used to re-compute a threshold for the next frame; wherein the marker comprises a marker pattern comprising a white square component with three black square areas centred thereon and forming an triangle, and further comprising a black border area enclosing said white square component, and the method further comprising a step of determining the centroids of the three black areas within the marker, and a step of determining which two black areas are parallel to any side of the square from the computed marker edge lines. a) providing 2D scene data in form of a digital image; b) thresholding the provided image into a binary black and white image while processing it to detect contiguous areas within the image; c) sequential labelling of objects in the binary image in order to find connected components, wherein in a single pass of the image every pixel is labelled as either belonging to the background or a foreground object with unique ID; and d) linearly analyzing said contiguous areas to determine whether they are a marker, wherein step d) comprises a step of calculating the Euler number of white areas in the thresholded binary image, the method further comprising the steps of comparing the calculated Euler numbers of the white areas with the given Euler number of the marker to be detected and discarding those white areas whose Euler number does match with the given Euler number; e) detecting the corners of contiguous areas within the image whose Euler number matches with the given Euler number; f) estimating hidden corners, comprising the steps of: 1) choosing two end points amongst consecutive pairs of detected comers; 2) collecting a sample of points along the marker boundary between the two end points; 3) estimating the parameters of two line candidates; 4) assigning to each line its member points amongst the sampled points, wherein every point belongs to that line to which it is nearest, thereby obtaining two sets of member points; 5) for each of the two sets of member points, refitting a line to estimate the line they lie on, wherein the two lines correspond to estimates of the marker edges; and 6) repeating steps 4) and 5) until convergence; 1) choosing two end points amongst consecutive pairs of detected comers; 2) collecting a sample of points along the marker boundary between the two end points; 3) estimating the parameters of two line candidates; 4) assigning to each line its member points amongst the sampled points, wherein every point belongs to that line to which it is nearest, thereby obtaining two sets of member points; 5) for each of the two sets of member points, refitting a line to estimate the line they lie on, wherein the two lines correspond to estimates of the marker edges; and 6) repeating steps 4) and 5) until convergence; g) repeating previous steps 1)-6) clockwise until four valid corners are found;