library(EBImage)
normalize performs linear interpolation of the intensity values of an image to the specified range.
x <- readImage(system.file('images', 'shapes.png', package='EBImage'))
x <- x[110:512,1:130]
y <- bwlabel(x)
display(x, title='Original')
print(range(y))
## [1] 0 7
y <- normalize(y)
print(range(y))
## [1] 0 1
display(y, title='Segmented')
packageVersion("EBImage")
## [1] '4.8.2'
efg
2015-01-18 2003