We present deep, high-quality K-band images of complete subsamples of powerful radio and sub-mm galaxies at z=2. The data were obtained in the best available seeing at UKIRT and Gemini North, with integration times scaled to ensure that comparable rest-frame surface brightness levels are reached for all galaxies. We fit two-dimensional axi-symmetric galaxy models to determine galaxy morphologies at rest-frame optical wavelengths > 4000A, varying luminosity, axial ratio, half-light radius, and Sersic index. We find that, while some images show evidence of galaxy interactions, >95% of the rest-frame optical light in all galaxies is well-described by these simple models. We also find a clear difference in morphology between these two classes of galaxy; fits to the individual images and image stacks reveal that the radio galaxies are moderately large (<r{1/2}>=8.4+-1.1kpc; median r{1/2}=7.8), de Vaucouleurs spheroids (<n> = 4.07+-0.27; median n=3.87), while the sub-mm galaxies appear to be moderately compact (<r{1/2}>=3.4+-0.3kpc; median r{1/2}=3.1kpc) exponential discs (<n>=1.44+-0.16; median n=1.08). We show that the z=2 radio galaxies display a well-defined Kormendy relation but that, while larger than other recently-studied high-z massive galaxy populations, they are still ~1.5 times smaller than their local counterparts. The scalelengths of the starlight in the sub-mm galaxies are comparable to those reported for the molecular gas. Their sizes are also similar to those of comparably massive quiescent galaxies at z>1.5. In terms of stellar mass surface density, the majority of the radio galaxies lie within the locus defined by local ellipticals. In contrast, while best modelled as discs, most of the sub-mm galaxies have higher stellar mass densities than local galaxies, and appear destined to evolve into present-day massive ellipticals.