Magnetic field measurement and imaging with nanometer resolution is a key tool in the study of magnetism. There have been several powerful techniques such as superconducting quantum interference device, hall sensor, electron microscopy, magnetic force microscopy and spin polarized scanning tunneling microscopy. However, they either have poor sensitivity or resolution, or need severe environment of cryogenic temperature or vacuum. The nitrogen-vacancy color center (NV center) in diamond, serving as a quantum magnetic sensor, has great advantages such as long decoherence time, atomic size, and ambient working conditions. The NV center consists of a substitutional nitrogen atom and an adjacent vacancy in diamond. Its electronic structure of ground state is a spin triplet. The spin state can be initialized to mS=0 state and read out by laser pulse, and coherently manipulated by microwave pulse. It is sensitive to the magnetic field by measuring the magnetic Zeeman splitting or quantum phase in quantum interferometer strategies. By using dynamical decoupling sequence to prolong the decoherence time, the sensitivities approach to nano tesla for a single NV center and pico tesla for the NV center ensemble, respectively. As a sensor with an atomic size, it reaches single-nuclear-spin sensitivity and sub-nanometer spatial resolution. Combining with scanning microscopy technology, it can accomplish high-sensitivity and high-resolution magnetic field imaging so that the stray field can be reconstructed quantitatively. The magnetic field is calculated from the two resonant frequencies by solving the Hamiltonian of NV center in order to obtain the value of stray field. Recently, this novel magnetic imaging technique has revealed the magnetization structures of many important objects in magnetism research. The polarity and chirality of magnetic vortex core are determined by imaging its stray field; laser induced domain wall hopping is observed quantitatively with a nanoscale resolution; non-linear antimagnetic order is imaged in real space by NV center. It was recently reported that magnetization of the magnetic skyrmion is imaged by NV center. The magnetization distribution is reconstructed from stray field imaging. With the topological number limited to one, the Nel type magnetization is uniquely determined. These results show that the magnetic imaging method has great advantages to resolve the emerging magnetic structure materials. The magnetic imaging technology based on the NV center will potentially become an important method to study magnetic materials under continuous development.