Raspberry pi:convert fisheye image to normal image using python
Question: I have attached the USB webcam with raspberry pi to capture image and write
code to send it using mail. It captures image using `fswebcam` commamnd so
code for capture image in python script is :

    
    
    subprocess.Popen(["fswebcam","-r 640x480", "image4.jpg"])
    

when I pressed switch from raspberry pi it capture image and sends it using
mail,but problem is that captured image is fisheye image and iIwant to convert
this fisheye image into normal image but I don't know the command for it or
any code to convert it into normal image using python in raspberry pi?
Thanks.This is my code:

    
    
    import smtplib
    import time
    import subprocess
    from email.MIMEMultipart import MIMEMultipart
    from email.MIMEBase import MIMEBase
    from email.MIMEText import MIMEText
    from email.MIMEImage import MIMEImage
    import RPi.GPIO as GPIO
    
    # Define these once; use them twice!
    strFrom = 'user.example@gmail.com'
    strTo = 'user.example@gmail.com'
    
    #create email
    # Create the root message and fill in the from, to, and subj$
    msgRoot = MIMEMultipart()
    msgRoot['Subject'] = 'capture image'
    msgRoot['From'] = strFrom
    msgRoot['To'] = strTo
    
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(4, GPIO.IN)
    print "press button to send email"
    GPIO.setup(4,GPIO.IN,pull_up_down=GPIO.PUD_UP)
    while True:
            input=GPIO.input(4)
            if input == False:
                    print "button pressed"
                    subprocess.Popen(["fswebcam","-r 640x480", "image4.jpg"])
                    time.sleep(5)
                    # This example assumes the image is in the current directory
                    fp = open('image4.jpg', 'rb')
                    msgImage = MIMEImage(fp.read())
                    fp.close()
    
                    msgRoot.attach(msgImage)
                    # send mail
                    s = smtplib.SMTP('smtp.gmail.com',587)
                    s.starttls()
                    s.login('user.example@gmail.com' , 'password')
                    s.sendmail(strFrom, strTo, msgRoot.as_string())
                    s.close()
                    print "Email sent"
                    time.sleep(0.2)
    

* * *

so how to add solution provided in this both link :
<https://github.com/kscottz/dewarp> and <http://www.kscottz.com/dewarped-
panoramic-images-from-a-raspberrypi-camera-module/> in to my above code.


Answer: Maybe this could help :  
<http://www.kscottz.com/dewarped-panoramic-images-from-a-raspberrypi-camera-
module/>

this is the corresponding repo :  
<https://github.com/kscottz/dewarp>

