1. A recognition device, comprising: a memory; and a hardware processor that: generates a trajectory of a pointer based at least in part on information relating to a movement of the pointer; detects that the pointer contacts an operation surface, determines a detection time when the pointer contacts the operation surface, and determines a detection position of the pointer at the detection time; sets the detection position as a starting point, determines an ending point on the operation surface corresponding to the starting point based on at least the detection time or the detection position without detecting that the pointer separates from the operation surface, and sets the trajectory from the starting point to the ending point as a target trajectory; and determines a command input by a user with a gesture of the pointer based on the target trajectory.