But this will not work if the shape is transformed, let's say if it is rotated to a specific angle then I am not getting the correct value.
A little testing seems to indicate that the round corner functionality of Photoshop also fails if the path is rotated (something else than a multiple of 90˚).
Or Is there any better way to do this?
You cou check that there are 8 points, then that there are two horizontal and two vertical segments, then that the distances two connecting points have from the mutual perpendicular segments are identical; furthermore you could evaluate the bezier handles.