python - How do I create a 2d image array out of 3 masked arrays? -
so i'm trying create image out of mean pixel values images have been saved 2d arrays. dark frames easy, had create running average. exposure time it's bit more complicated because have separate images using rgb masks. i'm having trouble combining masks coherent image. here's code creation of mean value array:
def set_bright_mean_array(self, directories): green_composite= np.zeros((self.rows, self.columns)) red_composite=blue_composite=green_composite n=0 k in range (len(directories)): exposure_file_names = self.set_exposure_file_names(self.exposure_directories[k]) in range(len(exposure_file_names)): print ('directory: %s -- loop: %s' % (directories[k], n)) temp_array=np.load(exposure_file_names[i]) green_delta = np.ma.masked_array(temp_array, self.green_mask_whole)-green_composite blue_delta = np.ma.masked_array(temp_array, self.blue_mask_whole)-blue_composite red_delta = np.ma.masked_array(temp_array, self.red_mask_whole)-red_composite n=n+1 green_composite=green_composite+green_delta/n blue_composite=blue_composite+blue_delta/n red_composite=red_composite+red_delta/n return np.concatenate((green_composite, blue_composite, red_composite))
np.concatenate
doesn't work, because shape of array (7392, 3280) opposed original image size: (2464, 3280). zip
didn't work because returns zip object, , have plot afterwards.
edit:
for clarification, masked arrays same shape original array, blank values (--, not sure on dtype) in place of actual numbers in pixels aren't right color. need figure out how join them together, while replacing empty values values other masked arrays create actual rggb image.
Comments
Post a Comment