PhotoRec is an open-source command line tool to recover lost pictures. The developer page contains a very good HowTo. For this reason I think I keep this article as short as possible.
To download PhotoRec and gain more information on how it works visit the homepage of the developers. http://www.cgsecurity.org/wiki/PhotoRec
If you install it with your packet manager (Linux) it comes as part of the packet TestDisk.
A small issue I noticed while using it: Sometimes the program is not able to detect a mounted media card. If this happens under Linux, type:
into a terminal to get a list of all mounted devices. Pick the device path of your media card and start PhotoRec with this path as parameter.