crop_image: Esta funcao corta a imagem retirando as laterais nao...

View source: R/crop_image.R

crop_imageR Documentation

Esta funcao corta a imagem retirando as laterais nao desejadas. (This function removes unwanted sides from the images.)

Description

Esta funcao permite cortar a imagem (This function allows you to crop the image).

Usage

crop_image(im,w=NULL,h=NULL,segmentation=NULL,plot=TRUE,
   extent=NULL,verbose=FALSE)

Arguments

im

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

w

Deve ser um vetor contendo os numeros das colunas que permanecerao na imagem (It must be a vector containing the column numbers that will remain in the image).

h

Deve ser um vetor contendo os numeros das linhas que permanecerao na imagem (It must be a vector containing the numbers of the lines that will remain in the image ).

segmentation

matrix binaria obtida por uma segmentacao (Binary matrix obtained of a segmentation)

plot

Indica se sera apresentada (TRUE) ou nao (FALSE) (default) a imagem segmentada (Indicates whether the segmented image will be displayed (TRUE) or not (FALSE) (default)).

extent

Caso a imagem seja do tipo TIF este objeto devera ter um vetor com quatro valores de coordenadas que delimitam a area a ser cortada. Neste caso o argumento raster deve ser TRUE (If the image is of type TIF, this object must have a vector with four coordinate values that delimit the area to be cut. In this case the raster argument must be TRUE).

verbose

Indica se sera apresentada (TRUE) ou nao (FALSE) (default) os pontos de corte (Indicates whether the segmented image will be displayed (TRUE) or not (FALSE) (default) the points crop).

Value

Retorna uma imagem cortada, apresentando apenas os pixels selecionados (Returns a cropped image showing only selected pixels).

Author(s)

Alcinei Mistico Azevedo (Instituto de ciencias agrarias da UFMG)

See Also

edit_image , edit_imageGUI

Examples

#library(ExpImage)
#Carregar imagem de exemplo
im=read_image(example_image(2),plot=TRUE)

##Cortar Imagem
im3=crop_image(im,w =286:421,h=242:332,plot = TRUE)

#Exemplo utilizando mascara
imb=read_image(example_image(2),plot=TRUE)
m=gray_scale(imb,"g/rgb",plot=TRUE)
mask=segmentation(m,threshold="otsu",plot=TRUE)
imc=crop_image(imb,segmentation=mask,plot=TRUE)

# intefacie grafica
## Not run: 
im=read_image(example_image(2),plot=TRUE)
im2=crop_image(im)

## End(Not run)



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