Masks¶
How to store them¶
-
class
Masks
(mask_factor, grid_increase, initial_mask, low_memory=0)¶ Class used to hold the mask for each iteration, as well as some of some important methods
-
add_mask
(mask)¶ Stores a new mask. If the low memory mode is active, only two masks are stored in memory: the initial one and the latest.
Parameters: mask – Mask to be added
-
all
¶ Return a list with all of the stored masks
-
factor
¶ Returns the mask’s size (i.e. circle radius or layers of pixels added to the mask)
-
first
¶ Returns the first mask
-
latest
¶ Returns the latest mask stored in the class
-
normalized_points
¶ Returns the number of points, normalized to the “normal” grid, with 200 by 200 px
-
number_masks
¶ Return the number of masks stored in the obejct
-
size
¶ Returns the number of pixels in the mask
-
update_mask
(x_change, y_change, image_number)¶ - Changes the mask to the correct position in the new image. If the grid_bg is not None, then the calculations are made with the bigger grid.
Parameters: - x_change – change in the x direction
- y_change – change in the y direction
- image_number – Current image number.
-
Shape Based mask¶
-
create_shape_mask
(im, stars, increase_factor, scaling_factor, primary, secondary, bg_grid, repeat_removal=0)¶ Finds the contours of the image, with openCv default functions
Parameters: - im – copy of the image used for the shape detection
- stars – list of all the
pyarchi.star_track.Star_class.Star
objects - increase_factor – Number of pixels added to the outside of the shape. For example, if factor = 1 then we add a layer of pixels around the entire shape
- size_grid_change – SIze of the background grid in use
- primary – Methodology to apply to the central star. If it’s dynam then the initial position of that star is changed to be the one determined here.
- secondary – Methodology to apply to the outer stars. If it’s dynam then the initial position of those stars are changed to be the ones determined here.
- repeat_removal – Number of times that we wish to remove the brightest mask from the image, to search for fainter stars
Returns: Dictionary where the keys are the number of the star and the values the corresponding mask
Return type: masks_dict
Circular mask¶
-
create_circular_mask
(img, stars, radius, primary, secondary)¶ Defines a circular mask for all the stars, with a pre determined radius. If a size_grid_change is different than zero it converts the mask to that grid size
Parameters: - stars – list of all the
pyarchi.star_track.Star_class.Star
objects - img – First image
- radius – radius of the circles. Can be a general radius(same for all the stars) or a dict with different radii,
- which the keys are the indexes and the values are the radius (in) –
- size_grid_change – size of the bigger grid, to which we can convert the mask. If it’s zero we don’t convert. Otherwise it is converted
- primary – Methodology to apply to the central star. If it’s fits then the initial position of that star is changed to be the one determined here.
- secondary – Methodology to apply to the outer stars. If it’s fits then the initial position of those stars are changed to be the ones determined here.
Returns: Dictionary where the keys are the number of the star and the values the corresponding mask
Return type: masks_dict
- stars – list of all the