What is the best way to install/build opencv and opencv_contrib for Jetson?

I recently started developing software for the Jetson Xavier NX platform.
I chose to use the official image that comes with JetPack 4.5.1 and opencv 4.1.1.
However, opencv_contrib, which is required by my software, was not installed.

Of course, as mentioned in some answers, we can build opencv and opencv_contrib from source.
However, as stated in the official Jetson Developer Guide, the opencv provided by JetPack was specifically optimized for Jetson platform. So my question is, if I build opencv from source, will I lose some performance gain compared to the JetPack opencv?

I also noticed that someone mentioned the opencv 4.1.1 provided by JetPack is not CUDA enabled. How come this opencv is optimized for Jetson if it is not CUDA enable?

I don’t think you will some performance gain if you build your own opencv. Please directly build it from source.

Actually there is no big optimization in performance. Just some internal test.