After the war of Sekigahara in 1600, the daimyo who fought against Tokugawa always faced discrimination from the new government.
These daimyos, who were mostly in the Western side of Japan, had been resentful of the Tokugawa family for 250 years.
Additionally, the attempt of opening Japanese ports to Westerners in 1853 got many daimyos worried about their future.
Because of these reasons there was a chaos between 1853 and 1867 (Bakumatsu period).
In 1867, the daimyos revolted in the imperial capital Kyoto and declared that they had overthrown the Tokugawa shogunate.
In 1868, the imperial capital moved from Kyoto to Edo (Tokyo) and Matsuhito Meiji then a 15 year old became the leader of Japan. The imperial family who lost its influence for 800 years was in power again.
Meiji strengthened the army and navy, invested in the textile industry and introduced a Western style constitution.
Japan won the first Sino-Japan war (1895). Japan also won the Japan-Russo war (1905) the first time an Asian nation beat a European nation.
Heavy industrialization increased the need for resources and Japan colonized Korea and Taiwan in this era.
Between 1868 and 1880 the samurai were stripped off from all of their privileges. Their land was confiscated, their government stipend was suspended, they were banned to carry katana and and they were banned to have the “chonmage” hairstyle.
The army uniforms and the weaponry were heavily Westernized during the Meiji period.