Image Demosaicing Quality in PlantCV versus LemnaBase
See original GitHub issueI have been using PlantCV for a while now to analyse LemnaTec Scanalyser visible-spectrum images, but it has come to my attention that the quality of the images generated by PlantCV (using OpenCV functions) is not as good as the native LemnaTec software and I am unsure why.
Images are downloaded using a forked version of Data Science Tools (LT-db-extractor.py). For our system, we initially found that OpenCV image conversion number 47 (cv::COLOR_BayerGB2BGR) worked best for us. Here’s a close-up:
You can see, the quality isn’t great around the edges of the object. Let’s look at the same image exported via LemnaBase:
Here the colours are better and edges sharper. In the past few days, I have played around with LT-db-extractor.py and changed the function on line 184 from:
img = cv2.cvtColor(raw_img, db['colour'])
to
img = cv2.demosaicing(raw_img, db['colour'])
I am not entirely sure what the difference between these functions is, but this change along with a modification in the OpenCV conversion format to #63 (cv::COLOR_BayerGB2BGR_VNG) has lead to considerable improvement:
Whilst better, it’s still not quite as good as the LemnaTec software version (ie there is still some colour artifacts on the edges). I am trying to work out whether there is a problem with OpenCV’s image demosaicing process or some other factor. I have written a small Python script that will open a LemnaTec blob file and attempt to make all 143 conversions for easy comparison (of course most fail, but it generates a PNG of those that work for easy assessment).
The other thing I am trying to figure out is the format of the blobs. Do you know are they encoded and what actually sits within? Each seems to contain multiple images, encoded in some unknown format and the metadata seems to be obtained from the database via a SQL query. There is a “data” file in there, but what does that contain? In what format is it encoded?
So many questions, but some insight would be a great help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
For sure!
OpenCV bilinear vs colour-demosaicing Malvar: 0.93852859491338958 OpenCV bilinear vs colour-demosaicing Menon: 0.90777965142929185
Structural similarity index comparisons: OpenCV bilinear vs colour-demosaicing bilinear: 0.99711175070708258 OpenCV bilinear vs OpenCV EA: 0.99442848407307005 OpenCV bilinear vs OpenCV VNG: 0.82513981615385668