This paper presents a new interaction technique for camera-enabled mobile devices. The handheld device can be used for writing just by moving the device. In our method, interframe dominant motion is estimated from images, and the discrete cosine transform is used for computing discriminating features from motion trajectories. The k-nearest neighbor rule is applied for classification. A realtime implementation of the method was developed for a mobile phone. In experiments, recognition rates ranging from 92 % to 98 % were achieved, which testifies to the practicality of our approach.