-
Notifications
You must be signed in to change notification settings - Fork 282
readbayer color channels are out of order #642
Description
Describe the bug
readbayer() is producing color images where the bands are out of order and image is rotated. I am actually getting a RGB image back (with bayertype 'BG') which means all the pcv functions are converting it to BGR when displaying, for example.
I tracked down cvtColor bug that seems to exist on and off in opencv from 2.4 -> 4.1 opencv/opencv#4857
The last version on conda forge with the correct behavior is 3.4.2. (did not try 4.x series)
To Reproduce
download https://github.com/danforthcenter/plantcv/files/4314758/Pats.Wheat.Root.Growth_002-0001_A1_2019-06-11_07-19-08.461_0.zip
import cv2
from plantcv import plantcv as pcv
filename='data/images/Pats Wheat Root Growth_002-0001_A1_2019-06-11_07-19-08.461_0.tif'
image_raw=cv2.imread(filename, -1)
img = cv2.cvtColor(image_raw, cv2.COLOR_BayerBG2BGR)
pcv.plot_image(img)
Expected behavior

or
even better rotated too which happens with opencv 3.4.2

Local environment (please complete the following information):
windows 10, conda, pcv 3.10.1 and latest master. seems dependent on opencv >3.4.2
Additional context
2 possible solutions until upstream gets fixed:
