|
Algorithm 2: Image random rotation enhancement algorithm |
|
Input: image max_angle |
|
Output: enhanced_image |
| 1: function random_rotation(image, max_angle) |
| 2: height, width = image.shape |
| 3: Randomly generate the rotation angle. Randomly generated rotation angle can be represented by the random number function rand:
|
| 4: Calculate the center of rotation. Assume that the coordinates of the center of rotation are .
|
| 5: Define the rotation matrix.
|
| 6: Performs image rotation. The position of each pixel after rotation is (,).
|
| 7: return rotated_image |
| 8: end function
|