I wanted to convert the BGR
image red by the imread
function to RGB
I timed both the cv
and python
to perform this operation
t1 = default_timer()
ima1 = cv2.cvtColor(ima,cv2.COLOR_BGR2RGB)
print("Time taken by cv2: ",default_timer()-t1)
t2 = default_timer()
ima2 = ima[..., ::-1]
print("Time taken by python: ",default_timer()-t2)
Here's the result
Time taken by cv2: 0.01933589199961716
Time taken by python: 7.061599990265677e-05
How is it that python is converting it faster than cv
?