""" # Set the amount of info printed to terminal during analysis logging.basicConfig(format='%(name)s:%(levelname)s:%(message)s', level=logging.INFO) show_results = False # Define the image you want to analyse n_imgs = 2 image_shape = (500, 500) downsample_factor = 4 super_image_shape = tuple(dim * downsample_factor for dim in image_shape) # Make a speckle image speckle_image = vlab.rosta_speckle(super_image_shape, dot_size=4, density=0.5, smoothness=2.0) displacement_function = vlab.deformation_fields.harmonic_bilat # Make an image deformed image_deformer = vlab.imageDeformer_from_uFunc(displacement_function, omega=2 * np.pi / (500. * downsample_factor), amp=2.0 * downsample_factor) # Make an image down-sampler including downscaling, fill-factor and sensor grid irregularities downsampler = vlab.Downsampler(image_shape=super_image_shape, factor=downsample_factor, fill=.95, pixel_offset_stddev=0.05)
As noise is a stochastic entity, we do a number of realisations for each noise amplitude. We use a fourier shift to shift the image by a given value, avoiding interpolation. <-Good! """ # Set the amount of info printed to terminal during analysis logging.basicConfig(format='%(name)s:%(levelname)s:%(message)s', level=logging.INFO) # We use only two images, a reference and a shifted image n_imgs = 2 # We use the rosta algorithm to make a speckle pattern # The image size is set to a convenient size of 500 x 500 pixels # The greyscales of the synthetic image spans [0,1] img = vlab.rosta_speckle((500, 500), dot_size=4, density=0.5, smoothness=3.0) # We can visualize the speckle plt.imshow(img,cmap=plt.cm.gray) plt.show(block=True) # Here are the settings for the analysis # We run the analysis for this range of gaussian noise standard deviations noise_stds = np.linspace(0.0, 0.03, 5) # We do a number of realisations for each noise standard deviation repts = 100 # We use a mesh of NxN elements num_elms = 20 # Shift amplitude along the X-axis shift_amp = 0.1