DropDetection_Sum

walk_forward(array:np.ndarray, steep:float)
Walk forward from the start index until we find a value greater than 0. Steep: a parameter that defines the steepness of the slope to detect the drop.
Parameters:
Returns:
int: The index where the drop is detected.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_walk_forward

backward(array:np.ndarray, steep:float)
Walk forward from the start index until we find a value greater than 0. Steep: a parameter that defines the steepness of the slope to detect the drop.
Parameters:
Returns:
int: The index where the drop is detected.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_backward

detect_drop(image:cv2.Mat, dims:tuple[int, int], show:bool, scaleDownFactor_x:int, scaleDownFactory:int)
Trying to detect images with less than 2ms delay. [V] 0. Convert image to grayscale, [V] 1. Resizing image, [V] 2. Applying gaussian blur (morphologyEx worked better than Gaussian blur), [-] 3. Transposing image (Optimization purposes) [Didn't improve any thing and because of if damaged was more than benefits], [V] 4. Summation over rows [-] 5. Normalize images based on height and maximum brightness, [V] 6. Finding beginning of the drop and ending of the drop, and finally drawing a rectangle around the drop.
Parameters:
Returns:
np.ndarray: Sum of rows of the processed image.
Caution:
Code will fail if there are more than one drop in the image.
Images should have exactly 5 rows of black pixels at the bottom of the image.
It works with tilted setup drop images, on other drop shape it is untested
Todo:
Going to test with C.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_detect_drop

detect_dropV2(image:cv2.Mat, dims:tuple[int, int], show:bool, scaleDownFactor_x:int, scaleDownFactory:int)
Same as V1 but added a version some that has seen the morphologyEx version image. Because if you have small drops in the end side of slide, which is highly probable it confuses the slope and the length of drop will be around 1000 pixels which is cause failure in 4S-SROF and other algorithms.
Parameters:
Returns:
np.ndarray: Sum of rows of the processed image.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_detect_dropV2

extendLength(array:np.ndarray, new_length:int)
Extend the length of the array to a new length by repeating the entire array.
Parameters:
Returns:
np.ndarray: The extended array with the new length.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_extendLength

draw_bounds(image:cv2.Mat, start:int, end:int, scaleDownFactor:int, thickness:int)
Draw a rectangle on the image from start to end. For testing purposes, it draws a rectangle on the image to visualize the detected drop.
Parameters:
Returns:
Italian Trulli
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_draw_bounds

detection(image:cv2.Mat, scaleDownFactor:int)
Detects the drop in the image by analyzing pixel intensity changes. For testing purposes, it returns the indices of the beginning and end of the drop.
Parameters:
Returns:
tuple[int, int]: Indices of the beginning and end of the drop in the image.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_detection

crop_and_save_image(input_path:str, output_path:str, x1:int, x2:int)
Crops a region from the input image and saves it to the output path.
Parameters:
Raises:
Examples:
crop_and_save_image("input.jpg", "output.jpg", 10, 20, 100, 200)
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_crop_and_save_image

Main(experiment:str, SaveAddress:str, SaveAddressCSV:str, extension:str, scaleDownFactor_x:int, drop_width:int, tolerance_width:float, _morphologyEx:bool)
Crops all images for a single experiment folder and saves crop info to CSV.
Parameters:
Raises:
Examples:
>>> Main("path/to/experiment", "path/to/save/cropped_images", "path/to/save/csv", extension='.png', scaleDownFactor_x=5, drop_width=300, tolerance_width=1.13)
Caution:
Adaptive approach to detect drops in images.
In this function width of the detected drop should be around 300 pixels or 115% of the image width. other wise the steep value will be adjusted to 0.005 from 0.0025. Some time a small drop in the end of slide can be sitting and that is enough to cause problems in the detection. We end up with a really wide image.
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_Main

perfMeasure()
Measure the performance of the drop detection algorithm. This function is a placeholder for performance measurement logic.
Returns:
[detection_perf] Avg peak memory usage: 158.03 KiB
Labels:

src_PyThon_ContactAngle_DropDetection_DropDetection_Sum_perfMeasure