-
Hi! I'm not sure if this is a bug or intended, hence the discussion. I was caught out today when using the I was caught out by the function expecting the array to be Of course this is the As here: https://plantcv.readthedocs.io/en/stable/custom_range_threshold/ it mentions that the input is I see there was a similar previous discussion about this in #559 for the RGB threshold. Thanks (and thanks for plantcv)! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @ajstewart, PlantCV primarily uses OpenCV, so our default handling of RGB images is BGR. When we use another tools (e.g. scikit-image) we convert between BGR->RGB->BGR in the backend when needed. But you are correct, In the documentation we refer to color images as RGB because that is the terminology most people are familiar with. Since most users use We have had team discussions about the BGR/RGB issue, which is problematics because 1) OpenCV is the outlier; and 2) the NumPy arrays are not annotated so you cannot tell the difference between BGR and RGB. Our longer term idea is to customize image NumPy arrays by extending them with some custom properties and/or methods so that you can distinguish between BGR, RGB, grayscale, hyperspectral, etc. and convert between them easily when needed. We have prototyped the basic functionality in #909 |
Beta Was this translation helpful? Give feedback.
Hi @ajstewart, PlantCV primarily uses OpenCV, so our default handling of RGB images is BGR. When we use another tools (e.g. scikit-image) we convert between BGR->RGB->BGR in the backend when needed. But you are correct,
pcv.threshold.custom_range
requires a BGR image.In the documentation we refer to color images as RGB because that is the terminology most people are familiar with. Since most users use
pcv.readimage
they are working with BGR images without necessarily realizing they are. Since you loaded an image with another tool (which other users may also do), we should document a procedure for converting images fromscikit-image
,imageio
, etc. into OpenCV/PlantCV compatible images.We…