Resampling filter omitting min and max values

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
DriesR
Posts: 2
Joined: 2014-12-10T06:23:31-07:00
Authentication code: 6789

Resampling filter omitting min and max values

Post by DriesR »

Dear,

I am looking for a way to resample an image which has a certain degree of image speckle. I want to resample and take the average pixel value of the resampled region, not taken into account the min and max value of that region. Another solution would be to make an histogram of all pixel values in the resampled region and before taking the average, cut of those values which are within sigma (st dev) or 2*sigma from the average.
Is this possible with the available filters, or are these all spatial filters?

best
Dries
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resampling filter omitting min and max values

Post by fmw42 »

Please upload an example image to some place like dropbox.com and put the URL here. Then explain what you mean by resampled region? Are you cropping some region and then resizing it or resizing/resampling the whole image? Why not remove the speckle first? Also identify what version of IM and what platform you are using.
DriesR
Posts: 2
Joined: 2014-12-10T06:23:31-07:00
Authentication code: 6789

Re: Resampling filter omitting min and max values

Post by DriesR »

Hi!

Thanks for the reply.. I played a little bit around and found that convert -mean-shift function did exactly what I needed. Picture before and after is available at https://drive.google.com/folderview?id= ... sp=sharing
Used function (from Python):

convert='c:\\ImageMagick-6.9.0-Q8\\convert.exe'
for x in range(1, 10):
procent=x*10
output=output_shift+'_'+str(procent)+'.jpg'
os.system(convert+ ' -mean-shift 30x30+'+str(procent)+'% ' + inputfile + " " + output)

cheers!
Dries
Post Reply