krnel | R Documentation |
main function to identify features in an image
krnel(
img,
crop = NULL,
resizw = NULL,
watershed = F,
huethres,
vthres = NULL,
minsize,
maxsize,
save.outline = F,
img.name = NULL,
blackbg = F,
whitebg = F,
ws.avg = F,
bw = F,
color.erode = F,
colerode.rad.ratio = 0.75,
open = FALSE,
open.brush.size = 5
)
img |
the path to the image file to analyze or an Image object as defined by the EBImage package |
crop |
a numeric vector in the form c(xmin, xmax, ymin, ymax) to define cropping area |
resizw |
the width of resized image to use for feature detection. decreasing the size of the image will improve performance |
huethres |
a numeric vector in the form c(Huemin, Huemax) to define Hue threshold. Can be easily determined using the get_huethr_values function |
vthres |
an optional v value threshold under which pixels are considered as part of features (override huesthres values) |
minsize |
the minimum size of features to be considered, in pixel, as determined on the resized image |
maxsize |
the maximum size of features to be considered, in pixel, as determined on the resized image |
save.outline |
boolean, should an outline image be saved in the same directory? |
img.name |
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. |
blackbg |
behave differently in case the background is black |
whitebg |
behave differently in case the background is white |
ws.avg |
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 |
bw |
boolean, is it a black and white (greyscale) image? In this case huethres is not required. |
color.erode |
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. |
colerode.rad.ratio |
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 |
open |
apply an open operation (erode+dilate) to suppress possible artefact attached to the detected feature. If watershed=T open is applied before watershed. |
open.brush.size |
size of the brush to use for the open operation. Brush shape is hardcoded as 'disc'. |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.