Skip to content

reconstruct_height_field_from_gradientReconstructHeightFieldFromGradientReconstructHeightFieldFromGradientreconstruct_height_field_from_gradientT_reconstruct_height_field_from_gradientπŸ”—

Short descriptionπŸ”—

reconstruct_height_field_from_gradientReconstructHeightFieldFromGradientReconstructHeightFieldFromGradientreconstruct_height_field_from_gradientT_reconstruct_height_field_from_gradient β€” Reconstruct a surface from surface gradients.

SignatureπŸ”—

reconstruct_height_field_from_gradient( image Gradient, out image HeightField, string ReconstructionMethod, string GenParamName, integer GenParamValue )void ReconstructHeightFieldFromGradient( const HObject& Gradient, HObject* HeightField, const HTuple& ReconstructionMethod, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.ReconstructHeightFieldFromGradient( HObject gradient, out HObject heightField, HTuple reconstructionMethod, HTuple genParamName, HTuple genParamValue )def reconstruct_height_field_from_gradient( gradient: HObject, reconstruction_method: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]] ) -> HObject

Herror T_reconstruct_height_field_from_gradient( const Hobject Gradient, Hobject* HeightField, const Htuple ReconstructionMethod, const Htuple GenParamName, const Htuple GenParamValue )

HImage HImage::ReconstructHeightFieldFromGradient( const HString& ReconstructionMethod, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HImage HImage::ReconstructHeightFieldFromGradient( const char* ReconstructionMethod, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HImage HImage::ReconstructHeightFieldFromGradient( const wchar_t* ReconstructionMethod, const HTuple& GenParamName, const HTuple& GenParamValue ) const (Windows only)

HImage HImage.ReconstructHeightFieldFromGradient( string reconstructionMethod, HTuple genParamName, HTuple genParamValue )

DescriptionπŸ”—

reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient reconstructs a surface from the surface gradients that are given in Gradientgradientgradient. The surface is returned as a height field, i.e., an image in which the gray value of each image point corresponds to a relative height.

The reconstruction is done by integrating the gradients by different algorithms that can be selected in the parameter ReconstructionMethodreconstructionMethodreconstruction_method. Because gradient fields are typically non-integrable due to noise, the various algorithms return a solution in a least-squares sense. The algorithms differ in the way how they model the boundary condition. Currently three algorithms are supported: 'fft_cyclic'"fft_cyclic", 'rft_cyclic'"rft_cyclic" and 'poisson'"poisson".

Reconstruction with Fast Fourier transforms

The variants 'fft_cyclic'"fft_cyclic" and 'rft_cyclic'"rft_cyclic" assume that the image function is cyclic at the boundaries. Note that due to the assumed cyclic image function artifacts may occur at the image boundaries. Thus, in most cases, we recommend to use the 'poisson'"poisson" algorithm instead.

The difference between 'fft_cyclic'"fft_cyclic" and 'rft_cyclic'"rft_cyclic" is that the rft version has faster processing times and requires less memory than the fft version. While theoretically fft and rft should return the same result, the fft version is numerically slightly more accurate. As reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient internally uses a fast Fourier transform, the run time of the operator can be influenced by a previous call to optimize_fft_speedOptimizeFftSpeed or optimize_rft_speedOptimizeRftSpeed, respectively.

Reconstruction according to Poisson

The 'poisson'"poisson" algorithm assumes that the image has constant gradients at the image border. In most cases, it is the recommended reconstruction method for reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient. Its run time can only be optimized by setting GenParamNamegenParamNamegen_param_name to 'optimize_speed'"optimize_speed" and GenParamValuegenParamValuegen_param_value to 'standard'"standard", 'patient'"patient", or 'exhaustive'"exhaustive". These parameters are described in more detail with the description of optimize_fft_speedOptimizeFftSpeed.

Note that by default, the 'poisson'"poisson" algorithm uses a cache that depends on the image size and that speeds up the reconstruction significantly, provided that all images have the same size. The cache is allocated at the first time when the 'poisson'"poisson" algorithm is called. Therefore the first call always takes longer than subsequent calls. The additionally needed memory corresponds to the memory needed for the specific size of one image. Please note that when calling the operator with different image sizes, the cache needs to be reallocated, which leads to a longer processing time. In this case it may be preferable to not use the cache. To switch off the caching, you must set the parameter GenParamNamegenParamNamegen_param_name to 'caching'"caching" and the parameter GenParamValuegenParamValuegen_param_value to 'no_cache'"no_cache". The cache can explicitly be deallocated by setting GenParamNamegenParamNamegen_param_name to 'caching'"caching" and GenParamValuegenParamValuegen_param_value to 'free_cache'"free_cache". However, in the majority of cases, we recommend to use the cache, i.e., to use the default setting for the parameter 'caching'"caching".

Saving and loading optimization parameters

The optimization parameters for all algorithms can be saved and loaded by write_fft_optimization_dataWriteFftOptimizationData and read_fft_optimization_dataReadFftOptimizationData.

Non obvious applications

Please note that the operator reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient has various non-obvious applications, especially in the field called gradient domain manipulation technique. In many applications, the gradient values that are passed as input to the operator do not have the semantics of surface gradients (i.e., the first derivatives of the height values), but are rather the first derivatives of other kinds of parameters, typically gray values (then, the gradients have the semantics of gray value edges). When processing these gradient images by various means, e.g., by adding or subtracting images, or by a filtering, the original gradient values are altered and the subsequent call to reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient delivers a modified image, in which, e.g., unwanted edges are removed or the contrast has been changed locally. Typical applications are noise removal, seamless fusion of images, or high dynamic range compression.

AttentionπŸ”—

reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient takes into account the values of all pixels in Gradientgradientgradient, not only the values within its domain. If Gradientgradientgradient does not have a full domain, one could cut out the relevant square part of the gradient field and generate a smaller image with full domain.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

ParametersπŸ”—

Gradientgradientgradient (input_object) singlechannelimage β†’ object (vector_field)HObject (vector_field)HImage (vector_field)HObject (vector_field)Hobject (vector_field)

The gradient field of the image.

HeightFieldheightFieldheight_field (output_object) image β†’ object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Reconstructed height field.

ReconstructionMethodreconstructionMethodreconstruction_method (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of the reconstruction method.

Default: 'poisson'"poisson"
List of values: 'fft_cyclic', 'poisson', 'rft_cyclic'"fft_cyclic", "poisson", "rft_cyclic"

GenParamNamegenParamNamegen_param_name (input_control) string-array β†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Names of the generic parameters.

Default: [][]
List of values: 'caching', 'optimize_speed'"caching", "optimize_speed"

GenParamValuegenParamValuegen_param_value (input_control) integer-array β†’ (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)Sequence[Union[int, float, str]]Htuple (Hlong / double / char*)

Values of the generic parameters.

Default: [][]
List of values: 'exhaustive', 'free_cache', 'no_cache', 'patient', 'standard', 'use_cache'"exhaustive", "free_cache", "no_cache", "patient", "standard", "use_cache"

ResultπŸ”—

If the parameters are valid reconstruct_height_field_from_gradientReconstructHeightFieldFromGradient returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

ReferencesπŸ”—

M. Kazhdan, M. Bolitho, and H. Hoppe: β€œPoisson Surface Reconstruction.” Symposium on Geometry Processing (June 2006).

ModuleπŸ”—

3D Metrology