Goal: Using morphological operations and contour analysis, try to programmatically mark every "tubules" in multiple "cilia" and sum the total count. Try to be as accurate as you can be - aim to remove unwanted areas using methods of computer vision
https://docs.opencv.org/3.4/d4/d76/tutorial_js_morphological_ops.html
Process the input image using morphological operations: erosion, dilation, opening, closing, tophat, bottom hat, distance transform.
Try different sizes and shapes of structuring elements
Work first with binary and then with grayscale images
Use various sequences of morphological operations (dilate, erode, erode, dilate…..open, close, close , open…)
Document the most important observations of this experiments
Try to "clean" the objects in the binary image from interfering objects so that only the so-called "tubules" remain using morphological operations.
Calculate the distance transform on a binary image and visualize it.
Try to "clean" the objects in the binary image from interfering objects so that only the so-called "tubules" remain using contour analysis and heuristic features.
Count the number of “tubules” in each “Cilie” using contour analysis
Calculate and visualize the histogram of grayscale input image
Experiment with erosion and dilatation on grayscale image, then compute and visualize histograms on newly processed images
Compare the histograms and make an observation
Dataset for this assignment:
https://drive.google.com/drive/folders/17wat24wJpJlBgsVN_b_GMl9zVVBI060m?usp=sharing
Document each attempt, even if it is unsuccessful (documentation example).
Use OpenCV documentation, below are some tips you may try.
convert to grayscale, display image and save to drive
cv::imread - reads an image from disk drive
cv::imshow / cv::waitKey - displays image
cv::cvtColor - converts RGB image to grayscale / other color spaces
(optional) cv::imwrite - writes image to drive
OpenCV display window
cv::resize - image resizing function, try different interpolation modes (nearest neighbor, linear)
Median blur (11) result
cv::dilate, cv::erode
cv::distanceTransform
cv::findContours - extracts contours from binary image
cv::drawContours - draws contours
contour filtering useful functions - cv::area, cv::boundingRect
Adaptive threshold and dilatation afterwards
cv::getStructuringElement - creates custom shape kernels (use in erosion or dilation)
cv::filter2d - runs convolution algorithm with hand-crafted kernel
3x3 kernel and result of convolution