Question

i am trying to make a QR for random text, blur it with ImageFilter then find the undestorted image' mean and take this away from the distorted image' mean.

i found pyFITS but i'm confused as to how it works to gather the image data, here is my code:

def show_image1(filename):
     IM=Image.open(filename)
     IM.show()

    QR = "HIDUGHEDG[REJG[ERWJGFERWJ[GJREJGE[RJ[]]]]]"


if __name__ == "__main__":
    myqr = qrcode.make(QR)
    #myqr.show()
    myqr.save("myqr4.png") 



file1 = 'myqr4.png'

ima = pyfits.getdata('myqr4.jpg')

#blurred  = ndimage.gaussian_filter(file1, sigma=3)



im = Image.open('myqr4.png')
im2 = im.convert('RGBA')
im3 = im2.filter(ImageFilter.BLUR)
scipy.misc.imsave('blurred.jpg', im3)
im_blur = Image.open('blurred.jpg')
im_blur.show()

im = pyfits.getdata('blurred.jpg')

print ima - im

also ideally i would like to blur the image using

#blurred  = ndimage.gaussian_filter(file1, sigma=3)

but it says 'undefined name 'ndimage' even though i have imported it with import scipy.ndimage

but anyway i would then like to put

sigma = x

then loop the value of x (sigma) between 1 and 5, then display the mean values of each distorted image, is this possible?

thanks for any help on any part of this.

Était-ce utile?

La solution

Just you want to calculate the mean value of an image means, use scipy library with python. Sample code:-

from scipy import misc
image_name = 'Birds.jpg'
calc_mean = misc.imread(image_name)
print calc_mean.mean()
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top