Tap your screen so it can re focus lol I'm teasing. Try a third party app. If that fails inspect the camera, is it scuffed up? Any moisture inside? Is the front camera ok? You can find and replace your devices drivers for the camera if rooted and you know how.
This seems to be a common problem for Mate 9 and 9 Pro and i've RESOLVED it in MY case.
FIrst, does the monochrome mode (camera) work OK? If so, then you *could* be in the same situation I was in.
So, first and most important, I have a gel cover on my case to absorb impacts or, at least stop the phone getting marked when dropped. I dropped my phone and it landed on one of the TOP corners. From this moment on, the COLOUR camera was out of focus. I asked around in the Mate 9 forum and it seems others have had this problem and one person there said he fixed it by tapping his phone. With this in mind i actually i banged mine on the other end ..... and focus was INSTANTLY much better, although not perfect. I then banged it again and focus is back to perfect!
In my case, it looks like my initial drop dislodged a lense/cover over the colour camera sensor and a "reverse" knock has vibrated it back in to place.
Again, check if this is just the colour sensor with the monochrome remaining perfect and, if you do try this, make sure you have something soft like a towel on the surface you're hitting to ensure your phone doesn't get marked.