As the culture had periodically done several times during the long history of its civilisation, Japan in the nineteenth century had turned inward and had isolated itself from the affairs of the rest of the world and incubated unique and refined art, literature and social etiquette.
While I suppose there’s a certain romancing element to uncontacted Japan, they definitely were not ignorant of the outside world, with a select few, government-vetted Chinese and Danish merchants doing brisk-business in a free-trade zone demarcated in the harbour of Nagasaki; they just didn’t care to be part of it. Maybe they conceded just to be rid of this presence, who lingered a lot in the area. Perry went as far as acquiring Taiwan (then called Formosa) as a base of operations, like America had done with Cuba and the Philippines. Once, however, their insular society was infiltrated, the Japanese did not suffer the fate of many other lands under colonialism, having taken the time to study the world at large, and instead excelled on the international stage and appropriated what was imposed upon them.