I am undistorting the color camera feed using the CROP resize mode:
cam_output = cam.requestOutput((640,400), type=frame_type, resizeMode=dai.ImgResizeMode.CROP, enableUndistortion=True)
As a result, the RGB camera output is produced at 640×400 resolution. However, when aligned depth output is enabled, although the reported resolution is also 640×400, the actual depth image appears centered with black borders around it.
I have attached screenshots of both the aligned depth output and the undistorted RGB camera output for reference.
Aligndepth output:

Color camera feed which is undistorted using above method.

How can we fix this issue?
If the align depth was of actual size, I would have applied CV based center crop of 640x400, but it's not the situation here.
This is how I call in align depth node and use it:
align_node = self.pipeline.create(dai.node.ImageAlign)
stereo_depth.depth.link(align_node.input)
# Link target camera output to alignment reference
cam_nodes[target_socket_name].link(align_node.inputAlignTo)
# Output queue & publisher
self.aligned_depth_queue = align_node.outputAligned.createOutputQueue(maxSize=4, blocking=False)