Noisy pixel maskingΒΆ
First, the mask of noisy pixels has to be determined and stored in a PNG file using the action NoiseDetection:
job = StackJob("job", "E:/Focus stacking/My image directory/")
job.add_action(NoiseDetection("noise-map", input_path=["src"]))
job.run()
Usually, this job should be run first, enabling the option plot_histograms, playing with the plot range (plot_range option) in order to determine the optimal threshold values (channel_thresholds) to be applied in order to mask a reasonable number of pixels. Once the threshold values are determined, the main focus stacking job should be ran adding the sub-action MaskNoise before AlignFrames and BalanceFrames.
Arguments for the constructor of NoiseDetection are:
name(optional, default:noise-map): name of the action and default name of the subdirectory withinworking_pathwhere aligned noise map is written.input_path(optional): one or more subdirectory withinworking_paththat contains input images to be combined. If not specified, the last output path is used, or, if this is the first action, theinput_pathspecified with theStackJobconstruction is used. If theStackJobspecifies noinput_path, at least the first action must specify aninput_path.output_path(optional): the subdirectory withinworking_pathwhere noise map is written. If not specified, it is equal toname.working_path(optional): the directory that contains input and output image subdirectories. If not specified, it is the same asjob.working_path.max_frames(optional): if provided, at mostmax_framesimages are analyzed to extract noisy pixel mask.method(optional, default:norm_lab): ifrgb, noisy channel are determined. separately on the R, G and B channel. If equal tonorm_rgb, the norm in the RGB color space is used to determine noisy pixels. If equal tonorm_lab, the norm in the LAB color space is used to determine noisy pixels.plot_path(optional, default:plots): the directory withinworking_paththat contains plots produced by the different actions.plot_histograms(optional, default:False): ifTrue, plot a summary of the number of hot pixel by channel as a function of the applied threshold. It may be useful to set the optimal threshold values.noisy_masked_px(optional, default:(100, 100, 100)): tentative number of noisy pixels to be masked. If set greater than zero, the threshold is computed automatically to match the desired number of pixels to mask. Ifmethod=norm, only the first of the three thresholds is used.channel_thresholds(optional, default:(13, 13, 13)): threshold values for noisy pixel detections in the color channels R, G, B, respectively. Each of these thresholds is only used of the corresponding value innoisy_masked_pxis set to zero. Ifmethod=norm, only the first of the three values is used.blur_size(optional, default: 5): image blur amount for pixel detection.file_name(optional, default:hot_pixels.png): noise map filename.enabled(optional, default:True): allows to switch on and off this module.
After the noisy pixel mask has been determined, noisy pixels are then masked adding the action MaskNoise to the Actions module:
job.add_action(Actions("mask", [MaskNoise(*options)]))
Or as preliminary stage to more actions:
job.add_action(Actions("align", [MaskNoise(),
AlignFrames(),
BalanceFrames(mask_size=0.9,
intensity_interval={'min': 150, 'max':65385})]))
Note that if the number of pixels contained in the mask file (noise_mask option) is greater than 1000, the job is aborted.
Arguments for the constructor of NoiseDetection are:
name(optional, default: empty): only used in the GUI as identifierenabled(optiona, default:True): enable/disable sub-actionnoise_mask(optional, default:hot-rgb.png): filename of the noise maskkernel_size(optional, default: 3): blur size use to extract noisy pixelsmethod(optional, default:INTERPOLATE_MEAN): possible values:INTERPOLATE_MEAN,INTERPOLATE_MEDIAN. Interpolate using mean or median of neighborhood pixels to replace a noisy pixel.enabled(optional, default:True): allows to switch on and off this module.