I have big issues when trying using packages that interpolate between data points.
I want to obtain a smooth curve out of my discrete data and to perform derivatives on them.
The data set is this:
using Images, Plots, ImageFiltering, Colors, Statistics, TestImages, ScatteredInterpolation, GMT
img10 = testimage("water_512.tiff")
img11 = testimage("moonsurface.tiff")
img12 = testimage("wood_grains_he_512.tiff")
img13 = testimage("blobs.gif")
img14 = testimage("fabio_gray_512.gif")
img15 = testimage("jetplane.tiff")
function average_color_gray(window)
return mean(window)
end
function color_std_gray(values)
return std(values)
end
function calculate_std_over_windows_gray(img, window_size)
h, w = size(img)
color_means = []
for i in 1:window_size:h-window_size+1
for j in 1:window_size:w-window_size+1
window = img[i:i+window_size-1, j:j+window_size-1]
mean_color = average_color_gray(window)
push!(color_means, mean_color)
end
end
# Calcola la deviazione standard dei colori medi
std_dev = color_std_gray(color_means)
return std_dev
end
std_devs = []
# Calcola la deviazione standard per ciascuna dimensione di finestra
for size in window_sizes
if size < min(width, height)
std_dev = calculate_std_over_windows(img12, size)
push!(std_devs, std_dev)
end
end
std_devss = std_devs[.!isnan.(std_devs)]
wind_siz = window_sizes[1:length(std_devss)]
ss = log.(1 ./ std_devss)
plot(1:9, ss)
Plots.scatter!(1:9, ss)
the result of this code should be a scatter plot of 9 points making a sigmoid, But I cannot succed in creating a smooth curve that approximate my data.
I tried to use Interpolations.jl, Dierckx.jl, ScatteredInterpolation,jl … but I always obtain errors saying that the method doesn’t mach or that the functions don’t exist. Even copy-pasting the documentation’s examples return errors.