Can I calibrate/rectify cameras with different focus and diffrent resolution?

I would like to ask some questions about stereoCalibrate and stereoRectify in calib3d library.
The detail scene is that I want to calibrate and rectify two cameras with different focus and resolution(i.e. camera1: f1=5mm, w1xh1=3840x2160; camera2: f2= 2mm, w2xh2=1600x1200).
The questions are: 1. When I use stereoCalibrate()/stereoRectify(), there is a param imageSize, which one should I choose?w1xh1 or w2xh2?In my case, I choose w1xh1, but I wonder is it right way to get the output R/T, R1/R2 etc.

since the docs are lacking in that regard, your options are to read the source and/or experiment and see what happens.

you might find some answers in relevant footnotes, which hopefully point to books. a lot of these algorithms are implementations from original publications (books, papers, lectures).

it should be possible to use dissimilar cameras and picture sizes. at some point, matrices will be calculated such that both camera views are scaled (and undistorted and rectified) so they’re comparable… i.e. suitable for block matching.