A method for recognizing a gesture in a three dimensional, 3D, space, the method being performed on a device comprising an annotated and indexed gesture database including a database of annotated gesture images, wherein each entry in the database of annotated gesture images is normalized in image size and is tagged with associated 3D motion parameters comprising three orientation and three position parameters and wherein the annotated and indexed gesture database includes features extracted from a computed edge image of the normalized gesture image, wherein the features are represented in an edge pixel format having a position and an orientation for each pixel of edge images of the normalized gesture images, the device further comprising a sensor adapted to capture an image of the 3D gesture being a query input comprising the gesture and noisy background, the method comprising: - forming, based on the features, a large-scale vocabulary table comprising the features of each entry of the database of annotated gesture images in a gesture search engine, the large-scale vocabulary table representing the annotated gesture images in an edge pixel format and comprising p × q × L columns and N rows, where each image of the annotated gesture images contains p × q pixels, L represents a number of edge orientations and N is a number of annotated gesture images in the database; - capturing the image of the 3D gesture via the sensor; - normalizing the captured image being the query input comprising the gesture and noisy background in accordance with the normalized gesture images of the database of annotated gesture images; wherein normalizing is resizing the captured image to the size of the database images, - extracting an edge image from the normalized captured image; - deriving features in the edge pixel format from the normalized captured image, the features being in the edge pixel format having a position and an orientation for each pixel of a set of edge points of the edge image of the normalized captured image, resulting in a query input in edge pixel format comprising a set of edge points; - comparing by using a direct similarity function the derived features of the set of edge points of the query input in edge pixel format with the extracted features, in the large-scale vocabulary table; - determining the best match from the database of annotated gesture images for the query input in edge pixel format based on the comparison; and - retrieving 3D motion parameters associated with the determined best matched gesture image from the database of annotated gesture images matching the image of the 3D gesture, the 3D motion parameters being used to modify a visual content presented on a display of the device. - forming, based on the features, a large-scale vocabulary table comprising the features of each entry of the database of annotated gesture images in a gesture search engine, the large-scale vocabulary table representing the annotated gesture images in an edge pixel format and comprising p × q × L columns and N rows, where each image of the annotated gesture images contains p × q pixels, L represents a number of edge orientations and N is a number of annotated gesture images in the database; - capturing the image of the 3D gesture via the sensor; - normalizing the captured image being the query input comprising the gesture and noisy background in accordance with the normalized gesture images of the database of annotated gesture images; wherein normalizing is resizing the captured image to the size of the database images, - extracting an edge image from the normalized captured image; - deriving features in the edge pixel format from the normalized captured image, the features being in the edge pixel format having a position and an orientation for each pixel of a set of edge points of the edge image of the normalized captured image, resulting in a query input in edge pixel format comprising a set of edge points; - comparing by using a direct similarity function the derived features of the set of edge points of the query input in edge pixel format with the extracted features, in the large-scale vocabulary table; - determining the best match from the database of annotated gesture images for the query input in edge pixel format based on the comparison; and - retrieving 3D motion parameters associated with the determined best matched gesture image from the database of annotated gesture images matching the image of the 3D gesture, the 3D motion parameters being used to modify a visual content presented on a display of the device.