One of the limitations on imaging fluorescent proteins within living cells is that they are usually present in small numbers and need to be detected over a large background. We have developed the means to isolate specific fluorescence signals from background by using lock-in detection of the modulated fluorescence of a class of optical probe termed "optical switches." This optical lock-in detection (OLID) approach involves modulating the fluorescence emission of the probe through deterministic, optical control of its fluorescent and nonfluorescent states, and subsequently applying a lock-in detection method to isolate the modulated signal of interest from nonmodulated background signals. Cross-correlation analysis provides a measure of correlation between the total fluorescence emission within single pixels of an image detected over several cycles of optical switching and a reference waveform detected within the same image over the same switching cycles. This approach to imaging provides a means to selectively detect the emission from optical switch probes among a larger population of conventional fluorescent probes and is compatible with conventional microscopes. OLID using nitrospirobenzopyran-based probes and the genetically encoded Dronpa fluorescent protein are shown to generate high-contrast images of specific structures and proteins in labeled cells in cultured and explanted neurons and in live Xenopus embryos and zebrafish larvae.