I'm using python and I was trying to do intensity transformation an image without numpy. So on the process, I need to log() the pixel of the image with math.log() but it looks like math.log() can't process an array like numpy did.
Should I do manual loop or is there any alternative?
Here's some code :
import cv2 as cv
import numpy as np
import math
img = cv.imread("272.jpg", cv.IMREAD_GRAYSCALE)
print(img)
# Output :
# array([[ 80,  72,  58, ...,  74,  77,  82],
#      [ 65,  59,  50, ...,  87,  88,  91],
#      [ 50,  47,  43, ..., 120, 117, 117],
#      ...,
#      [168, 158, 144, ...,  44,  52,  65],
#      [168, 157, 142, ...,  69,  74,  85],
#      [170, 156, 138, ...,  92,  94, 100]], dtype=uint8)
print(np.log(img))
# this works
print(math.log(img))
# error
 
    