- 
      
- 
        Save arc279/8aae1d275e6c4fe5aa753bb5c36975f1 to your computer and use it in GitHub Desktop. 
    hog特徴量を抽出して描画
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import cv2 | |
| import matplotlib.pyplot as plt | |
| from skimage.feature import hog | |
| from skimage import color, exposure | |
| img = cv2.imread('test2.png') | |
| image = color.rgb2gray(img) | |
| fd, hog_image = hog(image, orientations=9, pixels_per_cell=(8, 8), | |
| cells_per_block=(3, 3), visualise=True) | |
| hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 0.1)) | |
| plt.axis('off') | |
| plt.imshow(image, cmap=plt.cm.gray) | |
| plt.show() | |
| plt.axis('off') | |
| plt.imshow(hog_image_rescaled, cmap=plt.cm.gray) | |
| plt.savefig("test3.png") | |
| plt.show() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment