exclude_object: Exlude objects in an image by encircling them or using a mask...

View source: R/exclude_object.R

exclude_objectR Documentation

Exlude objects in an image by encircling them or using a mask (Excluir objetos em uma imagem circundado-os ou usando uma mascara).

Description

The function excludes objects by encircling them or using a mask. (A funcao exclui objetos circundando-os ou usando uma mascara).

Usage

exclude_object(im,mask=NULL,valueTarget = 0,color=c(r=1,g=1,b=1),plot=TRUE)

Arguments

im

:This object must contain an image in EBImage format (Este objeto deve conter uma imagem no formato do EBImage).

mask

: Object with the masks of the object of interest, can be obtained by the segmentation function, if it is NULL the object can be circled by clicking on the plot (Objeto com as mascaras do objeto de interesse, pode ser obtido pela funcao segmentation, se for NULL o objeto podera ser circundado clicando sobre o plot).

valueTarget

:Value corresponding to the mask pixels corresponding to the objects of interest (Valor correspondentes aos pixels da mascara correspondentes aos objetos de interesse).

color

: Vector with R, G and B values that will replace object pixels (Vetor com valores de R, G e B que substituirao os pixels dos objetos).

plot

: Logical value, if TRUE the image will be plotted (Valor logico, se for TRUE a imagem sera plotada).

Value

Returns an image with pixel values equal to 1(white) for the foreground and 0 (black) for the foreground (Retorna uma imagem com valores de pixel igual a 1( branco) para o foreground e 0 (preto) para o foreground).

Author(s)

Alcinei Mistico Azevedo (Instituto de ciencias agrarias da UFMG)

See Also

segmentation , segmentation_logit, segmentation_logitGUI

Examples


# Abrindo a imagem
im=read_image(example_image(3),plot=TRUE)

#Obtendo a escalad e cinza
m=gray_scale(im,method = "r/rgb",plot=TRUE)

#Obtendo a mascara
seg=segmentation(m,treshold = 0.50,selectHigher = TRUE,fillHull = TRUE,plot=TRUE)

#Excluindo o objeto
exclude_object(im,mask=seg,valueTarget = 0,color=c(r=0.95,g=0.94,b=0.94))

#dilatando o objeto e excluindo-o
seg2=dilate_image(seg,n=5)
exclude_object(im,mask=seg2,valueTarget = 0,color=c(r=0.95,g=0.94,b=0.94))


exclude_object(im,mask=seg2,valueTarget = 1,color=c(r=0.95,g=0.94,b=0.94))

## Not run: 
 # Segmentar e excluir clicando sobre a imagem.
exclude_object(im,valueTarget = 1,color=c(r=0.95,g=0.94,b=0.94))

## End(Not run)

ExpImage documentation built on Jan. 6, 2023, 1:24 a.m.