目标:更改图像的色彩饱和度
代码:
using Images, ImageView;
function updateChannelSaturation(path::String, channel::Int, percentage::Float64)
if isfile(path)
img = load(path);
chnlView = channelview(img);
cumPercentage = (100.0+percentage)/100.0;
chnlView = permuteddimsview(chnlView, (2, 3,1));
x = Int(size(img,2)/2):size(img,2);
chnlView[;, x, channel] = min.(chnlView[;, x, channel] .* cumPercentage,1);
imshow(img);
else
info("Error: Image Not Found!");
end
end
#By Prof.Bogumił Kamiński
function quit()
print("Press q to quit!");
while true
opt = getChar();
if opt == 'q'
break
else
continue
end
end
end
#By Prof.Bogumił Kamiński
function getChar()
ret = ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), stdin.handle, true)
ret == 0 || error("unable to switch to raw mode")
c = read(stdin, Char)
ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), stdin.handle, false)
c
end
updateChannelSaturation("/opt/julia/pictures/test.jpg", 1, 10.0);
quit();
错误:
no method matching permutedDimsArray(::typof(channelview), ::Tuple(Int64, Int64, Int64));
请帮助我解决问题!