Skip to content

simulate_motionSimulateMotionSimulateMotionsimulate_motionsimulate_motion🔗

Short description🔗

simulate_motionSimulateMotionSimulateMotionsimulate_motionsimulate_motion — Simulation of (linearly) motion blur.

Signature🔗

simulate_motion( image Image, out image MovedImage, real Blurring, integer Angle, integer Type )void SimulateMotion( const HObject& Image, HObject* MovedImage, const HTuple& Blurring, const HTuple& Angle, const HTuple& Type )static void HOperatorSet.SimulateMotion( HObject image, out HObject movedImage, HTuple blurring, HTuple angle, HTuple type )def simulate_motion( image: HObject, blurring: float, angle: int, type: int ) -> HObject

Herror simulate_motion( const Hobject Image, Hobject* MovedImage, double Blurring, const Hlong Angle, const Hlong Type )

Herror T_simulate_motion( const Hobject Image, Hobject* MovedImage, const Htuple Blurring, const Htuple Angle, const Htuple Type )

HImage HImage::SimulateMotion( double Blurring, Hlong Angle, Hlong Type ) const

HImage HImage.SimulateMotion( double blurring, int angle, int type )

Description🔗

simulate_motionSimulateMotion simulates blurring caused by a relative motion between the object and the camera during exposure. The simulated motion moves along an even. Angleangleangle fixes its direction by specifying the angle between the motion direction and the x-axis (anticlockwise, measured in degrees). Simulation is done by a convolution of the image with a blurring specific impulse response. The convolution is realized by multiplication in the Fourier domain. simulate_motionSimulateMotion offers five prototypes of impulse responses conforming to different acceleration behaviors. Typetypetype allows to choose one of the following PSF prototypes:

  1. reverse ramp (crude model for acceleration)

  2. reverse trapezoid (crude model for high acceleration)

  3. square pulse (exact model for constant velocity), this is default

  4. forward trapezoid (crude model for deceleration)

  5. forward ramp (crude model for high deceleration)

(default value is 3.)

The simulated blurring affects all part of the image uniformly. Blurringblurringblurring controls the extent of blurring. It specifies the number of pixels (lying one after another) that are affected by the blurring. This number is determined by velocity of the motion and exposure time. If Blurringblurringblurring is a negative number, an adequate blurring in reverse direction is simulated. If Angleangleangle is a negative number, it is interpreted clockwise. If Angleangleangle exceeds 360 or falls below -360, it is transformed modulo(360) in an adequate number between [0..360] resp. [-360..0].

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 tuple level.

  • Automatically parallelized on channel level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)HImage (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)Hobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

image to be blurred.

MovedImagemovedImagemoved_image (output_object) image → object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

motion blurred image.

Blurringblurringblurring (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

extent of blurring.

Default: 20.020.0
Suggested values: 5.0, 10.0, 20.0, 30.0, 40.05.0, 10.0, 20.0, 30.0, 40.0

Angleangleangle (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Angle between direction of motion and x-axis (anticlockwise).

Default: 00
Suggested values: 0, 45, 90, 180, 2700, 45, 90, 180, 270

Typetypetype (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

impulse response of motion blur.

Default: 33
List of values: 1, 2, 3, 4, 51, 2, 3, 4, 5

Result🔗

simulate_motionSimulateMotion returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty simulate_motionSimulateMotion returns with an error message.

Combinations with other operators🔗

Combinations

Possible predecessors

gen_psf_motionGenPsfMotion, gen_psf_motionGenPsfMotion

Possible successors

simulate_defocusSimulateDefocus, wiener_filterWienerFilter, wiener_filter_niWienerFilterNi

See also

gen_psf_motionGenPsfMotion, simulate_defocusSimulateDefocus, gen_psf_defocusGenPsfDefocus

References🔗

Anil K. Jain:Fundamentals of Digital Image Processing, Prentice-Hall International Inc., Englewood Cliffs, New Jersey, 1989

M. Lückenhaus:“Grundlagen des Wiener-Filters und seine Anwendung in der Bildanalyse”; Diplomarbeit; Technische Universität München, Institut für Informatik; Lehrstuhl Prof. Radig; 1995.

Kha-Chye Tan, Hock Lim, B. T. G. Tan:“Restoration of Real-World Motion-Blurred Images”;S. 291-299 in: CVGIP Graphical Models and Image Processing, Vol. 53, No. 3, May 1991

Module🔗

Foundation