# \donttest{
#Carregando imagens de exemplo
end=example_image(13)
im=read_image(end,plot=TRUE)
seg1=clustering_Kmeans(im,bands = "all",ncluster = 2,col = c("green","red"))
seg2=clustering_Kmeans(im,bands = c(1,2,3),ncluster = 3,col = c("green","red","blue"))
seg3=clustering_Kmeans(im,bands = c(1,2,3),ncluster = 4,col = "rand")
im=read_image(example_image(3))
Fundo=read_image(example_image(4))
Folha=read_image(example_image(5))
Ref=read_image(example_image(6))
paleta=list(Fundo=Fundo,Folha=Folha,Referencia=Ref)
col=c("black","green","red")
#### Criando imagem
Image=segmentation_RF(im=im,
palette=paleta,
return="image",
NumMax=1000,
col=col,
seed=NULL,
norma=1,
plot=TRUE)
#Criando um modelo
model=segmentation_RF(im=im,
palette=paleta,
return="model",
NumMax=1000,
col=col,
seed=NULL,
norma=1,
plot=FALSE)
image=predict_RF(im,model,col="rand",plot=TRUE)
# Outra forma de criar a paleta de cores
pallete2=rbind(
cbind(Class="Fundo",linearize_image(Fundo)[,-c(1,2)]),
cbind(Class="Folha",linearize_image(Folha)[,-c(1,2)]),
cbind(Class="Referencia",linearize_image(Ref)[,-c(1,2)]))
Image=segmentation_RF(im=im,
palette=pallete2,
return="image",
NumMax=1000,
col="rand",
seed=NULL,
norma=1,
plot=TRUE)
# }
Run the code above in your browser using DataLab