I have tried to develop a simple method of correcting some artefacts in an
image with R. Before proceeding further with image analysis.
An example of my attempt:
im <- load.example('coins')
imr <- as.raster(im)
sel <- locator(n=1)
x1 <- floor(sel$x)
x2 <- x1+10
y1 <- floor(sel$y)
y2 <- y1+10
imr[y1:y2,x1:x2] <- "#FFFFFF"
# I want this correction to be immediately visible without the need for
imr2 <- imr
This works. But I want to improve it to be more flexible inmaking
The improvements that I am thinking of are:
1. Instead of a rectangular area, I want a circular one. And I want
the painting to be visible directly without the need for replotting. I
would like to be able to enlarge slowly the area where I need to do the
corrections (with multiple small corrections to cover an irregular area).
This may require other techniques. For example, with shiny. I know almost
nothing about it. Would appreciate some tips to get started.
2. I am having trouble with specification of colour in the hexadecimal
mode. How can I convert a grayscale image to a numerical mode? I would like
to be able to have corrections made with the intensity in a certain range.
How do I access the colour values at specific locations? I did not succeed
with the getValues function (in a different image).