A while ago I was researching Japanese modernization in Bakumatsu and the Meiji era. I was surprised to find this image of a gunnery drill in 1841 (I think). Following up on it I read that the Shognate began importing military manuals to modernize its military in response to the Opium War, including forging cannon.
I was only able to find very limited information on this from a single source, so I'd love to know more. How extensive was the modernization? Were there other reforms related to the situation? How did the Opium War affect Japanese policy in general?
In general, both the Shogunate and the educated Japanese public (which was not the majority of the population) were quite alarmed by the Opium War. For a good many Japanese, the Opium War seemed to confirm many of their suspicions about Western barbarism and their malicious intentions. For example, there was a 250 page illustrated history of the War published in 1849, Kaigai Shinwa (New Stories from Overseas) by Mineta Fuko that depicted the war in a sensationalist detail. Other samurai leaders Sakuma Shozan would emphasize that the war underscored the need of Japan to modernize its coastal defenses.
The problem was the Opium War led to a generalized sense that Japan needed to defend itself from the foreign threat, but there was little consensus as to accomplish such a matter. While some reformers wanted to adapt Western technology to resist Western incursions immediately, some within the Bakumatsu took the War as a sign that Japan needed to adapt a more pliant attitude towards Western envoys.
For more on this, I suggest the relevant sections of Marius Jansen's The Making of Modern Japan and MIT's "The Opium War in Japanese Eyes". The latter source contains reproductions and translations of Mineta's opus and an excellent analysis from John Dower.