Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-217

EXIF Orientation Apply

Problem

Apply common EXIF orientation values to a 2D image.

orientation 1 keeps the image, 3 rotates it 180 degrees, 6 rotates it 90 degrees clockwise and 8 rotates it 90 degrees counterclockwise. You may assume orientation is one of 1, 3, 6, 8.

Test cases

case 1
in: [[[1,2,3],[4,5,6]],1]
expected: [[1,2,3],[4,5,6]]
case 2
in: [[[1,2,3],[4,5,6]],3]
expected: [[6,5,4],[3,2,1]]
case 3
in: [[[1,2,3],[4,5,6]],6]
expected: [[4,1],[5,2],[6,3]]
case 4
in: [[[1,2,3],[4,5,6]],8]
expected: [[3,6],[2,5],[1,4]]
Starter codePython
def apply_orientation(image, orientation):
    # Your code here
    pass

4 test cases · run your code against them in the editor