krnel.Rd
main function to identify features in an image
krnel(
img,
crop = NULL,
resizw = NULL,
watershed = F,
huethres,
minsize,
maxsize,
save.outline = F,
img.name = NULL,
blackbg = F,
ws.avg = F,
bw = F,
color.erode = F,
colerode.rad.ratio = 0.75
)
the path to the image file to analyze or an Image object as defined by the EBImage package
a numeric vector in the form c(xmin, xmax, ymin, ymax) to define cropping area
the width of resized image to use for feature detection. decreasing the size of the image will improve performance
a numeric vector in the form c(Huemin, Huemax) to define Hue threshold. Can be easily determined using the get_huethr_values function
the minimum size of features to be considered, in pixel, as determined on the resized image
the maximum size of features to be considered, in pixel, as determined on the resized image
boolean, should an outline image be saved in the same directory?
name of the image. This is useful in the case img is an Image object and save.outline is TRUE. This will be used for the name of the outline file.
behave differently in case the background is black
watershed average : this allows to perform a watershed after a feature detection with no watershed, and to compute for each feature bbox width/height average and sum on the different sub-features obtained through watershed
boolean, is it a black and white (greyscale) image? In this case huethres is not required.
boolean, apply morphological erosion to each feature before getting feature's color. This is way to estimate color from the center part of each feature, to avoid border effects.
if color.erode is true, this is the size of the round brush used for morphological erosion expressed as a ratio (>0, <=1) of the average radius of all feaures detected on the image
the function will return krnel object, ie. a list with three components
features : a data.frame with as many rows as the number of detected features and description variables as returned by EBImage::computeFeatures It also includes : (i) bounding box width and height aka Feret min and max diameter (bbox.width, bbox.height), (ii) pole of inaccessibility coordinates and longest distance to 'coastline' (poi.x,poi.y,poi.dist). In complex shapes, poi.dist might be a good measure of object width.
contours : a list with as many elements as the number of detected features. Each element is a matrix with the coordinates of each feature.
bbox : a list with as many elements as the number of detected features. Each element is a list with 4 components: $pts that contains the coordinates of each corner of the bounding box, $width, $height, and $angle
params : a list with the analysis parameters. can be used for further plotting
ws.contours : if ws.avg=T. a list with as many elements as the number of detected main features. Each element is a list of matrices with contours coordinates of each sub-features.
ws.bbox : if ws.avg=T. The same with bounding boxes
ws.pois : if ws.avg=T. The same with point of inaccessibility