Is there any similar function in Gocv like np.where() in Python? I want to specify some specific pixel values to 0, and others to 255. As follows, in Python I can do:
img = cv2.imread("test.png", cv2.IMREAD_GRAYSCALE)
img_ = np.where(img == 144 , img*0, np.where(img == 170 , img*0, np.where(img == 178 , img*0, np.where(img == 187 , img*0, 255))))
the pixel values which are 187, 178, 170, 144 will be set to 0, and others to 255. How can I do this job in Golang with Gocv?
I just found out that there is nothing like np.where() in gocv. All I have to do is: 1. get []byte using Mat.ToBytes() 2. writing a for loop to check each pixel in []byte and changing it if meet the condition. 3. get Mat from gocv.NewMatFromBytes()