How to use the MATLAB Computer Vision toolbox’s bundle adjustment for automatic panoramic image Stitching?

Solution for How to use the MATLAB Computer Vision toolbox’s bundle adjustment for automatic panoramic image Stitching?
is Given Below:

I am trying to implement automatic panoramic image stitching as in the Panorama. I have obtained the connected components of the panorama images. For the bundle adjustment step, I am trying to use the MATLAB computer vision toolbox’s bundle adjustment functions for optimizing the camera parameters and structure jointly by using the motion and/or motion and structure.

Since these functions are demonstrated on 3D points, how can I get the 3D points without triangulating? For the triangulation, I need to find the feature points and their matching in all the connected components again and it is computationally repetitive.

As in MATLAB’s bundle adjustment function
[xyzRefinedPoints,refinedPoses] = bundleAdjustment(xyzPoints,pointTracks,cameraPoses,intrinsics) requires xyzPoints, cameraPoses,intrinsics. How to find the camera poses and intrinsics if the camera is not calibrated? Also, triangulation is required for all the images in connected components to obtain the 3D points.

I am asking this as there is no good example to use these functions on the 2D images. Any inputs are much appreciated.