Thanks for great presentation of Images.jl at JuliaCon 2023. I haven’t really used the package (I’m not doing much work on images), but I see that I can import raw files from several camera brands. Nice.
I’m curious about the following: is it possible to selectively change some color to another color? This can be done in, say, Adobe Lightroom. To illustrate my question, I had the following image created using Bing Image Creator, with command “grumpy professor with yellow bowtie drinking tequila in Santa Fe adobe bar in picasso style”.
Suppose I now am very happy with the picture (AI generated with some random seed, so impossible to exactly recreate). However, I regret that I specified “yellow bowtie” and wish I instead had written “orange bowtie”.
Question: Is it possible to specify that I want to change the yellow color shades in the image to shades of orange?
I think you can define a range of colors that are yellowish in the same way as above by including the blue channel as well: (0.95 .≤ red.(img) .≤ 1) .&& (0.95 .≤ green.(img) .≤ 1) .&& (0 .≤ blue.(img) .≤ 0.05)
If selecting pixels based on color alone does not give you what you want, consider starting with a segmented image (e.g., ImageSegmentation) and then algorithmically change the color. E.g.,
function more_orange(col::AbstractRGB)
r, g, b = red(col), green(col), blue(col)
r *= 1.2
if r > 1
r, g, b = r/r, g/g, b/b
end
return oftype(col, RGB(r, g, b))
end
and then use more_orange on the pixels of the segment corresponding to the bowtie.