Hi I have the following heat map (probability map) of an object. 
 How can I convert this heatmap to a binary image? I want to take the maximum area of the object to increase the intersection with the image in the right side.
I really appreciate any help.
How can I convert this heatmap to a binary image? I want to take the maximum area of the object to increase the intersection with the image in the right side.
I really appreciate any help. 
            Asked
            
        
        
            Active
            
        
            Viewed 1,104 times
        
    0
            
            
         
    
    
        S.EB
        
- 1,966
- 4
- 29
- 54
- 
                    Use matplotlib's [`savefig()`](https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.savefig.html)... – zwer Jun 10 '17 at 00:50
1 Answers
0
            
            
        To binarize, compare against a threshold:
thresh = 0.5
bin_map = prob_map > thresh
From there you can use a very large variety of solutions:
Saving a numpy array as an image
I recommend this one from migas:
from PIL import Image
im = Image.fromarray(A)
im.save("your_file.jpeg")
 
    
    
        Colby Toland
        
- 16
- 2