It looks like data corruption somewhere. If you have an SDXC card have you tried setting the camera app to save to SD card for comparison?
You could also try a third party camera app to see if that creates the same type of corruption. For instance side-load the camera app Google uses on their Pixel devices, you can download it at XDA-developers (scroll down to How to Get the Google Camera on Any Phone):
https://www.xda-developers.com/get-pixel-2-features-android/
If those two doesn't fix it, try doing a hard reset from the phone's boot menu, make sure to choose the option called 'wipe data/factory reset; to try and get rid of any corrupted data. This will erase everything on your phone, so make sure to save anything you want to keep. Maybe write down which apps you have and such. Backup emails and documents.... To enter the boot menu first power off your phone then press and hold the Home button, Volume Up and the Power Button simultaneously until you get to a blue screen most likely saying something like "No command". Wait there and after a few seconds you'll be presented with a menu of Android recovery option. You browse the options with the volume rocker (up and down for up and down) and you select an option by tapping the power button after you've highlighted it. First choose the option called Wipe Cache Partition. This will erase any cached system settings Android/Samsung/devs has applied. When that's done choose the menu option called Wipe Data/Factory Reset to erase everything and automatically re-install the factory image.
If your camera is still acting up after this I guess you get the joys of contacting the seller about a repair/replacement.