Skip to content

Trait Extraction

collincornman edited this page Dec 10, 2019 · 22 revisions

We use OpenCV on the predicted images in order to extract various information as these plants grow. We wrote and have added the file trait_extraction.py to our repository for extracting necessary information to a .CSV output file. Currently, the only plant that we have full functionality for trait extraction is sorghum. The following are the various options for extraction.

Plant Height

We get the total height of the plant from the base within the pot to the tip of the inflorescence. We first get the Y coordinate of the heightest point on the plant. Then we get y coordinate from the middle of the pot. Then we calculate the distance between those two points.

alt text alt text

Stem Height

We get the height of the orange colored region which represents the stem of the sorghum.

Unflowered Plant

Here we can simply find the top and bottom of the longest contiguous orange line on the photo. Then we just subtract the top from the bottom and multiply it by our zoom ratio to get the stem height.

alt text

Flowered Plant

With a flowered plant the process is slightly different. We first find the inflorescence and take its bottom coordinates. Then we just subtract that from the bottom of the stem and multiply it by our zoom ratio again to get the flowered stem height.

alt text

Inflorescence Height & Width

We get the width and height of the purple colored region which represents the inflorescence of the sorghum.

  1. We crop the picture to a smaller window that the inflorescence is only likely to show in.

  2. We find only the areas in the picture with the color purple.

alt text

3. Use OpenCV functions erosion and dilution to remove the incorrectly purple areas on the picture, reducing the noise.
  1. Draw rectangular contours around the area and use these positions to calculate the height and width of the inflorescence.

  2. Pass the values of the height & width of the inflorescence to a dictionary and return the highest values.

alt text