Skip to main content
added 308 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];

fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];

fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
added 308 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Log[Abs[fft]] - Min[Log[Abs[fft]]];Abs[fft];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftAbsData - fftAbsMin)/(fftAbsMax - fftAbsMin)]Colorize[Image[fftAbsData], 
        ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {Exp[fftAbsMin + Min[Log[Abs[fft]]]]fftAbsMin, 
    Exp[fftAbsMax + Min[Log[Abs[fft]]]]fftAbsMax}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description hereenter image description here

With a modified color table:

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange}, x]}, {x, 1/50, 
      1, 1/50}], 
    Table[{Blend[{Orange, Red, White}, x]}, {x, 1/206, 1, 1/206}]};

one gets:

enter image description here

The same way I getthe FFT for the phases is:

fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData]; 

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description hereenter image description here

img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Log[Abs[fft]] - Min[Log[Abs[fft]]];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftAbsData - fftAbsMin)/(fftAbsMax - fftAbsMin)], 
        ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {Exp[fftAbsMin + Min[Log[Abs[fft]]]], 
    Exp[fftAbsMax + Min[Log[Abs[fft]]]]}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description here

The same way I get for the phases:

fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description here

img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Abs[fft];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[fftAbsData], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftAbsMin,fftAbsMax}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description here

With a modified color table:

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange}, x]}, {x, 1/50, 
      1, 1/50}], 
    Table[{Blend[{Orange, Red, White}, x]}, {x, 1/206, 1, 1/206}]};

one gets:

enter image description here

The same way the FFT for the phases is:

fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData]; 

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]

enter image description here

deleted 56 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Log[Abs[fft]] - Min[Log[Abs[fft]]];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Show[
      Colorize[Image[(fftAbsData - fftAbsMin)/(fftAbsMax - fftAbsMin)], 
        ColorFunction -> (Blend[myColorTable, #] &)]
    ];

myLegend = 
  BarLegend[
    {myColorTable, {Exp[fftAbsMin + Min[Log[Abs[fft]]]], 
    Exp[fftAbsMax + Min[Log[Abs[fft]]]]}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

g = Show[
      Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)]
    ];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Log[Abs[fft]] - Min[Log[Abs[fft]]];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Show[
      Colorize[Image[(fftAbsData - fftAbsMin)/(fftAbsMax - fftAbsMin)], 
        ColorFunction -> (Blend[myColorTable, #] &)]
    ];

myLegend = 
  BarLegend[
    {myColorTable, {Exp[fftAbsMin + Min[Log[Abs[fft]]]], 
    Exp[fftAbsMax + Min[Log[Abs[fft]]]]}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

g = Show[
      Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)]
    ];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
   
fft = Fourier[ImageData[img]];
fft = RotateLeft[fft, Floor[Dimensions[fft]/2]];
    
fftAbsData = Log[Abs[fft]] - Min[Log[Abs[fft]]];
    
{fftAbsMin, fftAbsMax} = MinMax[fftAbsData];

myColorTable = 
  Flatten@{Table[{Blend[{Blue, Green, Yellow, Orange, Red}, x]}, {x, 1/256, 1, 1/256}]};

g = Colorize[Image[(fftAbsData - fftAbsMin)/(fftAbsMax - fftAbsMin)], 
        ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {Exp[fftAbsMin + Min[Log[Abs[fft]]]], 
    Exp[fftAbsMax + Min[Log[Abs[fft]]]]}}, 
    LegendLabel -> "amplitude", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
fftPhasesData = Arg@fft/Pi;

{fftPhasesMin, fftPhasesMax} = MinMax[fftPhasesData];

g = Colorize[Image[(fftPhasesData - fftPhasesMin)/(fftPhasesMax - 
        fftPhasesMin)], ColorFunction -> (Blend[myColorTable, #] &)];

myLegend = 
  BarLegend[
    {myColorTable, {fftPhasesMin, fftPhasesMax}}, 
    LegendLabel -> "phase (\[Pi])", LegendMarkerSize -> {40, 300}, 
    LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}
  ];

Legended[
  Graphics[
    Inset[g, Scaled[{.5, .5}], Automatic, Scaled[1]], Frame -> True, 
    FrameLabel -> {{"cycles/pixel", ""}, {"cycles/pixel", ""}}, 
    PlotRange -> {{-0.5, 0.5}, {-0.5, 0.5}}, 
    AspectRatio -> ImageAspectRatio@g
  ]
  , myLegend
]
added 64 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
Loading
added 890 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
Loading
added 30 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
Loading
deleted 74 characters in body
Source Link
lio
  • 2.4k
  • 14
  • 26
Loading
Source Link
lio
  • 2.4k
  • 14
  • 26
Loading