Module ObjectDetection
This module manages the detection of object on video frame. It allows the choice of the method to mots appropriate to discriminate the particles from the free surface.
- ObjectDetection.histogram_detection(img, params)[source]
Find area corresponding to selected histogram
- Parameters:
nbr_classes – number of class in the histogram
roi_detect – size of the ROI selected
color_choice – type of image color (RGB,HSV,gray)
color_band – band for the histogram measurement (RGB,HSV,gray)
- Returns:
list of detected particles positions [ID trajectory, X position, Y position, size, intensity]
- Return type:
list
- ObjectDetection.method_DoG(img, params)[source]
Original method of tractrac software. The detection is obtained by the convolution of the frame by a double gaussian function.
- Parameters:
img – frame treated
peak_conv_size – size of the gaussian for filtering (in pixel)
type_particle – Light/Dark particle
peak_sub_pix – method for sub-pixel detection No method, Quadratic ,Gaussian
peak_th_auto – (True/False) use automatic threshold to find maximum value on the convoluted frame
peak_th – threshold to find maximum value on the convoluted frame
peak_neigh – size of filter for the convoluted frame (pixel)
- Returns:
list of detected particles positions [X position, Y position]
- Return type:
list
- ObjectDetection.method_GoodFeatureToTrack(img, params)[source]
Shi and Tomasi Method directly availiable in openCV library
- Parameters:
img – frame treated
max_corner – nombre maximal de détection par image
quality_level –
min_distance –
block_size –
- Returns:
list of detected particles positions [X position, Y position]
- Return type:
list
- ObjectDetection.method_threshold(img, params)[source]
Frame thresholding with binarization to extract position, area and intensity of each particle
- Parameters:
img – frame treated
intensity_min – minimal intensity of selected particles(in level 0-255)
intensity_max – maximal intensity of selected particles (in level 0-255)
size_min – minimal length of selected particles (in pixel)
size_max – maximal length of selected particles (in pixel)
lo – minimal intensity of selected particles for color frame (3 values ex: RGB, HSV)
hi – maximal intensity of selected particles for color frame (3 values ex: RGB, HSV)
- Returns:
list of detected particles positions [ID trajectory, X position, Y position, size, intensity]
- Return type:
list
- ObjectDetection.process_object_detection(img, params, id_method)[source]
Processing selected detection method
- Parameters:
img – frame treated
dict – dictionnary parameters
id_method – detection method
- Returns:
list of detected particles positions [ID trajectory, X position, Y position, size, intensity]
- Return type:
list
- ObjectDetection.select_method(param)[source]
Function for detection method selection Several methods are possible. The good feature to track method is the most common method based on the shi method. It is original method with the opyflow software. The threshold is the simplest but needs the user calibration. The Dog Method is the original method for tractrac software The Histogram is dedicated to track of specific object.
- Parameters:
dict – dictionnary parameters
- Return type:
int
- ObjectDetection.track_manual_detection_init(img, params)[source]
Define the histogram of the selected ROI
- Parameters:
nbr_classes – number of class in the histogram
color_choice – type of image color (RGB,HSV,gray)
color_band – band for the histogram measurement (RGB,HSV,gray)
- Returns:
size of the ROI selected
- Return type:
list (height, width)
- Returns:
histogram value in selected ROI
- Return type:
list