ppmcentre [ options ] files or directoriesppmcentre processes image files, it's primary objective is to find and centre the dominant object in each frame to make life easier for processing by Registax or other astronomy image-stacking programs.
With no file or directory arguments ppmcentre will process all image files in the current directory that it understands. If you name a directory, then all image files in that directory will be processed.
Support file formats are:
You control ppmcentre's behaviour by giving one or more switches with optional parameters on the command line.
All switches start with -
Any parameter not starting with - is assumed to be either an image file or the name of a directory containing image files. Switches and files are processed in the order that they appear in the command line, so it would be normal to provide all the switches first and then follow with the list of files or directories to be processed.
The supported options are:
NOTE: W MUST be an even number, and to be safe you should also make it a multiple of 4.
NOTE: When image rescaling is specified, W is interpreted as relative to the original image size (i.e. without rescaling).
Default: Width of input image (no cropping)
NOTE: H MUST be an even number, and to be safe you should also make it a multiple of 4.
NOTE: When image rescaling is specified, W is interpreted as relative to the original image size (i.e. without rescaling).
Default: Height of original image (no cropping).
This cutout size should be large enough to contain your object, but keeping it small speeds up other processing (rescaling, smoothing, gamma) as they apply only to the region inside the cutout.
If your target image is very small you may want to decrease this value.
Default value 40
Without this switch ppmcentre will write it's output into the same directory as its input, but this will fail unless you also specify -overwrite.
D can be either a relative directory, or an absolute directory. A relative directory is one that doesn't start with a directory separator (/ or \ depending on your O/S).
e.g. If you use -outdir=output (relative path) then ppmcentre will create a directory named output under the directory holding the input images.
If you use -outdir=\out (MS Windows absolute path) or -outdir=/out (UNIX absolute path) then this is taken as a top-level directory name, and not relative to the input images.
In all cases ppmcentre will create the output director(ies) as required, or die with a complaint if it doesn't have permission to do so.
NOTE: This behaviour is different to earlier versions of ppmcentre which would by default overwrite their input. Now you have to specify -overwrite to get the old behaviour if you really want it :-)
By default when ppmcentre creates a FIT output file it adds two special pixels (black & white) in the bottom left corner to stop histo-stretching by other programs. This switch turns this feature off.
NOTE: -width,-height,-cutx and -cuty always refer to the dimensions of the SOURCE image (i.e. before rescaling).
NOTE: If the image is scaled up by more than a factor of 2 then an implicit smoothing operation is enabled (see next option). This is not supported on colour images, and so you can't resample colour images by more than a factor of 2 unless you disable the smoothing.
Synonyms: -rescale -resample -upsample
Smoothing is ON by default, and you should not turn it off unless you know what you are doing.
Smoothing is not applied to an image if the scaling factor is <= 2
Smoothing is not supported on colour images in this version.
Gamma adjustments are not supported on colour images.
For each pixel in the input image we calculate a difference value D:
D = (P-A)/A
P is the value of the pixel we are considering and A is the modified average of its 8 neighbors.
A is computed by taking the 8 neighbors and replacing the brightest pixel value with the darkest pixel value. This is done in recognition that most noise will artificially increase pixel values and inflate the average value. Dark pixel values are more likely to be reliable than bright values.
If D is greater than F then the pixel P is too bright, and we replace P with A.
If D is less than -F then the pixel is too dark, and we replace P with the value (P+A)/2.
This filter can be applied multiple times by giving the option more than once. e.g. '-inputfilter -inputfilter' applies the filter twice.
The default values for F is 0.2. If you want to change this then specify a replacement value with the first filter iteration.
NOTE: Filtering is not supported on colour images.
The quality for an image is calculated by generating a series of downsampled images and summing the computed quality of each of those smaller images. This allows the algorithm to reject noise.
The series of downsampled images is controlled by the two parameters min and max. They represent the smallest and largest divisor that will be used to generate the downsampled images. All integer divisor values between min and max are used.
The default values are min=3 and max=5, leading to three downsampled images (divisors 3,4,5). You can adjust min and max to accommodate images that are much larger or smaller than normal.
The quality of each downsampled image is calculated by the sum of squares of differences between adjacent horizontal and vertical pixels. This exaggerates the differences and locates sharp gradients in the image, usually a sign of good quality. Only pixels which have values greater than the background level are considered (see -threshhold);
Note: The algorithm used here is the same as the gradient algorithm used in Registax, however the implementation used here in ppmcentre allows the algorithm to be examined by the user (via -qwrite) and fine-tuned using the min and max parameters.
You may find it useful to use the quality estimation function of ppmcentre to "pre-sort" all your frames so you can then select only those that are good enough to load into registax for alignment and stacking.
With this switch enabled ppmcentre will write all the downsampled images that are generated as part of the qestimator function. The images are written in the current directory as 8bpp monochrome PPM format, and are named sample_N.ppm with N being the sample level.
i.e. in the default case with min=3 and max=5, three images will be generated, sample_3.ppm, sample_4.ppm and sample_5.ppm.
These images are overwritten for each file that is processed, so if you are using this switch then it only makes sense to process one file.
After all files have been processed, ppmcentre will sort the output files according to their computed quality from best -> worst and then renumber all the output files accordingly.
For this to work it a requirement that the output filenames contain a number as part of their name, e.g. 00234.bmp.
The renumbering algorithm locates the numeric portion (either the first or last numeric portion) and changes only that part of the filename, leaving the rest of the filename alone.
The renumbered part of the filename will start with the letter q followed by that files ranking in the quality list, highest quality will have rank 0.
e.g. An output file named C:\tmp\00234-red.fit may end up as C:\tmp\q00368-red.fit after renumbering.