The HgβNiOβPt capacitor with a Hg top electrode diameter of about 35πm showed the typical bistable resistive switching characteristic. After the removal of the Hg top electrode, we directly observed the formation and removal of filaments for a high resistive state (π off) and a low resistive state (π on) by conducting atomic force microscope (CAFM). CAFM images for π off and π on states directly exhibit evidence of the formation and removal of filaments on the surface, which supports well the filament model as a switching mechanism of resistive random access memory.