ImageDev

SwapQuadrants

Performs a quadrant-wise translation in circular mode.

Access to parameter description

This algorithm performs a quadrant-wise translation in circular mode by a vector equal to half the diagonal of the image, as shown in Figure 1. In case of an odd image size, the center is rounded up or down according to the centerPolicy value.

It is generally used to visualize the modulus of the FFT centered in the middle of image rather than in the upper left corner. The image is centered by a translation in circular mode by a vector equal to half the diagonal of the image.

<b> Figure 1.</b> The results of a regular and a centered FFT
Figure 1. The results of a regular and a centered FFT

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > swapQuadrants( std::shared_ptr< iolink::ImageView > inputImage, SwapQuadrants::CenterPolicy centerPolicy, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
swap_quadrants(input_image: idt.ImageType,
               center_policy: SwapQuadrants.CenterPolicy = SwapQuadrants.CenterPolicy.CEIL,
               output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
SwapQuadrants( IOLink.ImageView inputImage,
               SwapQuadrants.CenterPolicy centerPolicy = ImageDev.SwapQuadrants.CenterPolicy.CEIL,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
centerPolicy
The way to round the center position in case of odd image dimensions.
FLOOR This mode rounds the center position to the closest inferior integer.
CEIL This mode rounds the center position to the closest superior integer.
Enumeration CEIL
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
center_policy
The way to round the center position in case of odd image dimensions.
FLOOR This mode rounds the center position to the closest inferior integer.
CEIL This mode rounds the center position to the closest superior integer.
enumeration CEIL
output
output_image
The output image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
input
centerPolicy
The way to round the center position in case of odd image dimensions.
FLOOR This mode rounds the center position to the closest inferior integer.
CEIL This mode rounds the center position to the closest superior integer.
Enumeration CEIL
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image null

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

SwapQuadrants swapQuadrantsAlgo;
swapQuadrantsAlgo.setInputImage( foam );
swapQuadrantsAlgo.setCenterPolicy( SwapQuadrants::CenterPolicy::CEIL );
swapQuadrantsAlgo.execute();

std::cout << "outputImage:" << swapQuadrantsAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

swap_quadrants_algo = imagedev.SwapQuadrants()
swap_quadrants_algo.input_image = foam
swap_quadrants_algo.center_policy = imagedev.SwapQuadrants.CEIL
swap_quadrants_algo.execute()

print("output_image:", str(swap_quadrants_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

SwapQuadrants swapQuadrantsAlgo = new SwapQuadrants
{
    inputImage = foam,
    centerPolicy = SwapQuadrants.CenterPolicy.CEIL
};
swapQuadrantsAlgo.Execute();

Console.WriteLine( "outputImage:" + swapQuadrantsAlgo.outputImage.ToString() );

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = swapQuadrants( foam, SwapQuadrants::CenterPolicy::CEIL );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.swap_quadrants(foam, imagedev.SwapQuadrants.CEIL)

print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.SwapQuadrants( foam, SwapQuadrants.CenterPolicy.CEIL );

Console.WriteLine( "outputImage:" + result.ToString() );