filtering Module


Uses

    • mod_queue

Variables

Type Visibility Attributes Name Initial
real(kind=8), public, parameter :: PI = 4*atan(1.0_8)

Functions

public pure function filtering_(img, filter, maximum_value, fill) result(filtered)

apply filter Arguments

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

image array. has pixel values.

integer, intent(in) :: filter(:,:)

filter array.

integer, intent(in) :: maximum_value

max pixel value.

logical, intent(in), optional :: fill

Whether does fill edge.

Return Value integer, allocatable, (:,:,:)

filtered image. same size as the argument img.

public pure function laplacian(img, maximum_value) result(output)

laplacian filtering (8 neighborhood)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array. has pixel values.

integer, intent(in) :: maximum_value

max value of a pix. default to 255.

Return Value integer, allocatable, (:,:,:)

filtered image array.

public pure function gaussian(img, maximum_value, n_times) result(output)

gaussian filtering (24 neighborhood)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array has pixel values.

integer, intent(in) :: maximum_value

Max value of a pix. default to 255.

integer, intent(in) :: n_times

Number of time apply filter.

Return Value integer, allocatable, (:,:,:)

Filtered image array.

public function sobel(img, maximum_value, is_canny) result(output)

sobel filter (sqrt version)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array has pixel values.

integer, intent(in) :: maximum_value

Max value of a pix. default to 255

logical, intent(in), optional :: is_canny

Whether is used in canny adge detection

Return Value integer, allocatable, (:,:,:)

Filtered image array

public function canny_edge_detection(img, maximum_value) result(output)

apply canny edge detection
the method is:
1. apply gaussian filtering
2. apply sobel filtering
3. non-maximum supperssion
4. edge tracking by hysteresis

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array has pixel values.

integer, intent(in) :: maximum_value

The max value of pixel.

Return Value integer, allocatable, (:,:,:)

Edge array

public pure function bilateral(img, sigma, maximum_value, n_times) result(output)

apply bilateral filter

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array has pixel values.

real, intent(in) :: sigma

use in gaussian distribution.

integer, intent(in) :: maximum_value

The max value of pixel.

integer, intent(in) :: n_times

Number of time to apply filter.

Return Value integer, allocatable, (:,:,:)

The image applied bilateral filter.

public pure function emboss(img, maximum_value) result(filtered_img)

apply emboss filter

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: img(:,:,:)

Image array has pixel value.

integer, intent(in) :: maximum_value

The max value of pixel.

Return Value integer, allocatable, (:,:,:)

The image applied emboss filter.


Subroutines

public pure recursive subroutine fill_edge(img, n_around)

fill edges with the same color as closest pix.

Arguments

Type IntentOptional Attributes Name
integer, intent(inout), dimension(:, :, :) :: img

image array. has pixel values.

integer, intent(in) :: n_around

The pix of fill edge.

public pure subroutine non_maximun_supperssion(edge_magnitudes, edge_ways)

Perform non-maximum_supperssin

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: edge_magnitudes(:,:,:)

Edge magnitude array.

real, intent(inout) :: edge_ways(:,:,:)

Edge directions array

public subroutine hysteresis(img, maximum_value)

Edge tracking by hysteresis

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: img(:,:,:)

Image array has pixel value.

integer, intent(in) :: maximum_value

The max value of pixel.