Add extract_4_color_channel_images_from_raw.py
				
					
				
			This commit is contained in:
		
							
								
								
									
										21
									
								
								datasets/raise/extract_4_color_channel_images_from_raw.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								datasets/raise/extract_4_color_channel_images_from_raw.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import numpy as np
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
from utils import Color, getColorChannel
 | 
			
		||||
 | 
			
		||||
IMAGE_FILE_PATH = '../rafael/240424/photos/DSC03294.ARW'
 | 
			
		||||
Y_RANGE = 5
 | 
			
		||||
X_RANGE = 25
 | 
			
		||||
ORIGINAL_INTERESTING_POSITION = (5752, 1695)
 | 
			
		||||
INTERESTING_POSITION = np.array(ORIGINAL_INTERESTING_POSITION)[::-1] // 2
 | 
			
		||||
 | 
			
		||||
colorChannel = getColorChannel(IMAGE_FILE_PATH, Color.RED)
 | 
			
		||||
print(colorChannel.shape)
 | 
			
		||||
 | 
			
		||||
def crop(image, interestingPosition, yRange, xRange):
 | 
			
		||||
    return image[interestingPosition[0] - yRange: interestingPosition[0] + yRange, interestingPosition[1] - xRange: interestingPosition[1] + xRange]
 | 
			
		||||
 | 
			
		||||
colorChannel = crop(colorChannel, INTERESTING_POSITION, Y_RANGE, X_RANGE)
 | 
			
		||||
colorChannel = colorChannel[INTERESTING_POSITION[0] - Y_RANGE: INTERESTING_POSITION[0] + Y_RANGE, INTERESTING_POSITION[1] - X_RANGE: INTERESTING_POSITION[1] + X_RANGE]
 | 
			
		||||
print(colorChannel.shape)
 | 
			
		||||
plt.imshow(colorChannel)
 | 
			
		||||
plt.show()
 | 
			
		||||
		Reference in New Issue
	
	Block a user