import numpy
from PIL import Image, ImageOps
def find_nearest(array,value):
idx=(numpy.abs(array-value)).argmin()
return idx
img=ImageOps.grayscale(Image.open('filename.ext'))
array=numpy.asarray(img)
fft_int=numpy.abs(numpy.fft.fft2(array))
size=fft_int.shape
fft_int=fft_int[0:size[0]/2,0:size[1]/2]
size=fft_int.shape
orig=fft_int.sum()
res=numpy.zeros(50)
for i in xrange(50):
res[i]=fft_int[0:size[0]*(i+1)/50,0:size[1]*(i+1)/50].sum()
res/=orig
numpy.savetxt('data.txt', res)
print "95% of mag:" + str(float(find_nearest(res, 0.95))/50.)
print "90% of mag:" + str(float(find_nearest(res, 0.90))/50.)
print "80% of mag:" + str(float(find_nearest(res, 0.8))/50.)
print "70% of mag:" + str(float(find_nearest(res, 0.7))/50.)
print "60% of mag:" + str(float(find_nearest(res, 0.6))/50.)
HQ version:
95% of mag:0.88
90% of mag:0.8
80% of mag:0.7
70% of mag:0.62
60% of mag:0.52
LQ version:
95% of mag:0.58
90% of mag:0.44
80% of mag:0.36
70% of mag:0.3
60% of mag:0.26
95% of mag:0.8
90% of mag:0.64
80% of mag:0.44
70% of mag:0.34
60% of mag:0.26
wjh31 wrote:After yet another 'record' at 200+GP, which only has 112GP effective being put in it, i was reminded of a few comments made during the discussion of the first 0.1TP picture by rio-hk.
The comments came from Castillonis, in which he mentioned a set of slides that came from a google talk (http://www.dicklyon.com/phototech/PhotoTech_27_Resolution_Slides.pdf) which contains discussion of how a fourier transform can be used to compare how much real resolution there is in an image.
Based on this i decided to have a look at seeing if i could impliment such an analysis. Here are the results:
<snip>
wjh31 wrote:Although not implimented here, one can imaging cutting large images into appropriately sized tiles, each of which has it's 95% resolution found. The 'true' resolution of the image would then be the sum of the 95% resolution of each tile. This would account for both low quality images, aswell as boring (i.e 50% sky, out of focus foreground etc) images.
pns wrote:thank you for this. sorry for my ignorance, but... what language is this, and how could a mere mortal try it on one's own images?
(any chance of a matlab port?)
pns wrote:would that be the sum or the average?
how do you think this would work on water, say choppy ocean under wind, with lots of detail but hardly more interest than plain sky?
Users browsing this forum: No registered users and 1 guest