The optical dispersion effect in ultrafast pulse laser systems broadens the laser pulse duration and reduces the theoretical peak power. The present study proposes an adaptive ultrashort pulse compressor for compensating the optical dispersion using a direct optical-dispersion estimation by spectrogram (DOES) method. The DOES has fast and accurate computation time which is suitable for real time controller design. In the proposed approach, the group delay dispersion (GDD) and its polarity are estimated directly from the delay marginal of the trace obtained from a single-shot frequency-resolved optical gating (FROG). The estimated GDD is then processed by a closed-loop controller, which generates a command signal to drive a linear deformable mirror as required to achieve the desired laser pulse compression. The dispersion analysis, control computation, and deformable mirror control processes are implemented on a single field programmable gate array (FPGA). It is shown that the DOES dispersion computation process requires just 0.5 ms to complete. Moreover, the proposed pulse compressor compensates for both static dispersion and dynamic dispersion within five time steps when closed-loop controller is performed at a frequency of 100 Hz. The experimental results show that the proposed pulse compressor yields an effective fluorescence intensity improvement in a multiphoton excited fluorescence microscope (MPEFM).