forensicfit.utils.image_tools module#

forensicfit.utils.image_tools.rotate_image(image, angle)[source]#

Rotates the image by angle degrees

Parameters:

angle (float) – Angle of rotation.

Returns:

None.

forensicfit.utils.image_tools.gaussian_blur(image, window=(15, 15))[source]#

This method applies Gaussian Blur filter to the image.

Parameters:

window (tuple int, optional) – The window in which the gaussian blur is going to be applied. The default is (15,15).

Return type:

None.

forensicfit.utils.image_tools.split_v(image, pixel_index=None, pick_side='L', flip=True)[source]#

This method splits the image in 2 images based on the fraction that is given in pixel_index

Parameters:
  • pixel_index (float, optional) – fraction in which the image is going to be split. The value should be a number between zero and one. The default is 0.5.

  • pick_side (str, optional) – The side in which will over write the image in the class. The default is ‘L’.

Return type:

None.

forensicfit.utils.image_tools.to_gray(image, mode='SD')[source]#

Gray Scale image of the input image.

modes: ‘BT.470’ and ‘BT.709’ SD ‘BT.470’ : Y = 0.299 R + 0.587 G + 0.114 B HD ‘BT.709’ : Y = 0.2125 R + 0.7154 G + 0.0721 B

Return type:

ndarray

Returns:

gray_scale – Gray Scale image of the input image.

Return type:

cv2 object

forensicfit.utils.image_tools.to_rbg(image)[source]#
forensicfit.utils.image_tools.flip(image)[source]#
forensicfit.utils.image_tools.contours(image, mask_threshold=60)[source]#

A list of pixels that create the contours in the image

Returns:

contours – A list of pixels that create the contours in the image

Return type:

list

forensicfit.utils.image_tools.largest_contour(contours)[source]#

A list of pixels forming the contour with the largest area

Returns:

contour_max_area – A list of pixels forming the contour with the largest area

Return type:

list

forensicfit.utils.image_tools.remove_background(image, contour, outside=True, pixel_value=0)[source]#

Removes the background outside or inside the contour

Parameters:
  • image (np.array) – _description_

  • contour (np.array) – _description_

  • outside (bool, optional) – _description_, by default True

  • pixel_value (int, optional) – _description_, by default 0

forensicfit.utils.image_tools.get_masked(image, mask_threshold)[source]#

Populates the masked image with the gray scale threshold Returns

forensicfit.utils.image_tools.resize(image, size)[source]#

This method resizes the image to the pixel size given.

Parameters:

size (tuple int,) – The target size in which the image is going to be resized.

Return type:

None.

forensicfit.utils.image_tools.exposure_control(image, mode='equalize_hist', **kwargs)[source]#

modifies the exposure

Return type:

ndarray

Parameters:

mode (str, optional) – Type of exposure correction. It can be selected from the options: 'equalize_hist' or 'equalize_adapthist'. equalize_hist and equalize_adapthist <https://scikit-image.org/docs/stable/api/skimage.exposure.html#equalize-adapthist> use sk-image. by default ‘equalize_hist’

forensicfit.utils.image_tools.apply_filter(image, mode, **kwargs)[source]#

Applies different types of filters to the image

Return type:

ndarray

Parameters:

mode (str) – Type of filter to be applied. The options are * 'meijering': <Meijering neuriteness filter https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.meijering>_, * 'frangi': < Frangi vesselness filter https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.frangi>_, * 'prewitt': <Prewitt transform https://scikit-image.org/docs/stable/api/skimage.filters.html#prewitt>_, * 'sobel': <Sobel filter https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.sobel>_, * 'scharr': <Scharr transform https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.scharr>, * 'roberts': <Roberts’ Cross operator https://scikit-image.org/docs/stable/api/skimage.filters.html#examples-using-skimage-filters-roberts>_, * 'sato': <Sato tubeness filter https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.sato>_.

forensicfit.utils.image_tools.binerized_mask(image, masked)[source]#

This function return the binarized version of the tape

Returns:

.

Return type:

2d array of the image

forensicfit.utils.image_tools.imwrite(fname, image, cmap='gray', **kwargs)[source]#

save any 2d numpy array (or list) to an image file

Parameters:
  • fname (str) – flie name to be saved

  • image (np.array) – 2d numpy array (or list) to be saved