문제

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.

도움이 되었습니까?

해결책

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()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top