initial commit
This commit is contained in:
		
							
								
								
									
										18
									
								
								imgrate.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										18
									
								
								imgrate.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					import cv2
 | 
				
			||||||
 | 
					from argparse import ArgumentParser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def laplacian_variance(image):
 | 
				
			||||||
 | 
					    grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
 | 
				
			||||||
 | 
					    return cv2.Laplacian(grayscale, cv2.CV_64F).var()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					    ap = ArgumentParser()
 | 
				
			||||||
 | 
					    ap.add_argument('images', type=str, nargs='+', help='')
 | 
				
			||||||
 | 
					    args = ap.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    image = cv2.imread(args.images[0])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    print(laplacian_variance(image))
 | 
				
			||||||
		Reference in New Issue
	
	Block a user