Giter Site home page Giter Site logo

mi79012 / ms-thesis-suplimentals-iradukunda Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 65.34 MB

These are supplemental materials for my MS Thesis in 2024 (Athens, GA)contain Python codes required from RGB image acquisition to analysis and example results(result.csv). In the 'imgs/' folder, you will find example images to perform described tasks.

Python 100.00%
analysis image imaging lettuce seedlings

ms-thesis-suplimentals-iradukunda's Introduction

Special thanks to my labmates in Horticultural Physiology (Kahlin B. Wacker), and Controlled Environment Agriculture (Jonathan S. Cardenas) for their help in getting started with coding and sharing their codes for me to make working functions. Pavel B. provided the image Segmentation code. Andrew R. Benecchi helped in debugging to improve the readability of the scripts.

The following are summarized details of what each code does

  1. Image Acquisition (image_capture_picam2.py):

    This code outlines a procedure for acquiring images using a Raspberry Pi camera module 2. Initially, the code imports necessary libraries for camera control and image processing. It initializes the camera module and sets up configurations such as image resolution and preview settings (these can be changed in the script). The script then defines the directory where the captured images will be stored, creating a new folder for each date if it doesn't already exist. Subsequently, it configures the camera focus to infinity to ensure sharp images and waits for a brief period to allow configurations to settle. Finally, it captures an image, saves it to the designated directory with a timestamp and camera information appended to the filename, and signals the end of execution ("END").

  2. Image Segmentation into 4 sections (image_segmentation_4points.py):

    The script begins with importing necessary libraries such as OpenCV, NumPy, and PIL for image processing, along with other utilities for file management and data manipulation. It sets the dimensions of the images to be processed and specifies the path where the images are stored (these can be changed in the script). The script then defines a function called unwarp for the perspective transformation of images (based on OpenCV). It proceeds to extract information from the image filenames to determine the start time of the experiment and the tray numbers (labels that will be later used to identify replications and treatment locations). Next, the script iterates through the images, performs image preprocessing including rotation, cropping, and color space conversion (from BGR to HSV), and applies thresholding to isolate specific colors (in this case, red). It then identifies the contours of the objects in the images, calculates their centroids, and unwraps the images to correct for perspective distortion. Subsequently, the script divides the images into smaller regions corresponding to individual pots within the trays, saving these cropped images in separate folders organized by date and tray number. Finally, the script signals the completion of the process ('END).

  3. Image analysis (image_analysis.py):

    This Python code is designed for analyzing images (resulted from script 2) to determine various parameters such as pixel count, average intensity, area, object count, average area, standard deviation of area, and germination percentage. The code utilizes the PlantCV library for image processing (requires special installation from https://plantcv.readthedocs.io/en/v3.0.4/installation/). It begins by defining functions for obtaining regions of interest (ROIs) as circles to identify plant locations and analyzing a single image as a model. The analyze_single_image function reads an image, converts it to grayscale, calculates a histogram, thresholds the image, and identifies connected components. It then calculates various parameters based on the segmented objects in the image. The PxEx function then helps the analysis process for multiple images within a specified directory (great care must be taken for directories). It iterates through each image, analyzes it using the analyze_single_image function, and writes the results to a CSV file (N.B: Close the CSV file before running it). Parameters such as minimum pixel size, calibration factor, image format, histogram minimum and maximum values for threshold adjustment, output file name, and directory containing the images are customizable inputs. Finally, the code prints "DONE" upon completion of the analysis.

ms-thesis-suplimentals-iradukunda's People

Contributors

mi79012 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.