We are working with this image:
And we are trying a project with singular value decomposition. Here is our approach:
We start by importing the image, which has this filename on our system, but it is the image above.
image = Import["DSC_0880-7.jpg"]
Then we do this:
A = ImageData[ImageTake[image, {1, 480}, {1, 640}], "Byte"];
Then we adjusted something we found on the web to help us:
Approximate[A_, k_] := Module[
{approximateImage},
{U, Σ, VT} = SingularValueDecomposition[N[A], k];
approximateImage = Graphics[
Raster[
U.Σ.Transpose[VT]/
Max[U.Σ.Transpose[VT]]],
PlotLabel ->
"Singular Values: " <> ToString[NumberForm[k, 3]] <>
" Compression: " <>
ToString[
NumberForm[
100*
k*(1. Dimensions[A][[1]] +
Dimensions[A][[2]])/(Dimensions[A][[1]]*
Dimensions[A][[2]])
"% of Original.", 2]
]
]
];
Then we try this:
Show[Approximate[A, 20]]
But our image is flipped upside down.
Can someone help us unflip our image?