Analysing film scans I use the values of fx minima.r, maxima.r, minima.g, maxima.g etc.
Is there a fast (these are 50mb files or more), way of calculating these values but removing outliers, (which is noise either from the scanning process or scratches on the original)
I am currently using blur 0x7, before calculating the max and min etc. Looking for ideas? I am only interested in removing the noise around the max and minimum values.
Removing noise from fx minima.r and maxima.r calculations

 Posts: 10022
 Joined: 20100123T23:01:3307:00
 Authentication code: 1151
 Location: England, UK
Re: Removing noise from fx minima.r and maxima.r calculations
How many pixels wide and high?
The "blur 0x7" will take time. Supplying a radius will reduce this, eg "blur 21x7". Faster still, use integral images (see Windowed mean and standard deviation), eg:
The "blur 0x7" will take time. Supplying a radius will reduce this, eg "blur 21x7". Faster still, use integral images (see Windowed mean and standard deviation), eg:
Code: Select all
convert in.tiff process integim process 'deintegim w 21x21' out.tiff
snibgo's IM pages: im.snibgo.com
Re: Removing noise from fx minima.r and maxima.r calculations
some scans 3000px others 7000pxsnibgo wrote: ↑20171226T07:27:5307:00How many pixels wide and high?
The "blur 0x7" will take time. Supplying a radius will reduce this, eg "blur 21x7". Faster still, use integral images (see Windowed mean and standard deviation), eg:Code: Select all
convert in.tiff process integim process 'deintegim w 21x21' out.tiff
Thanks, I have been steadily going through your pages, they are very helpful. I had seen the integim process, which actually inspired my question, for a "fx" style solution.
I will give integim a whirl

 Posts: 10022
 Joined: 20100123T23:01:3307:00
 Authentication code: 1151
 Location: England, UK
Re: Removing noise from fx minima.r and maxima.r calculations
Integim suggests another possibility: it can calculate the mean and standard deviation for a window around each pixel. We can then determine whether the pixel lies within the range (mean plus or minus k*SD), where k is whatever you decide is reasonable, eg 1 or 2 or 3. If it is outside the range, we declare the pixel an outlier, so we replace it by the range limit. Otherwise we leave it alone.
This is a smarter method of removing outliers than simply replacing each pixel with a mean, which is what blur does. However, it adds time and complexity, and may be overkill.
EDIT: I should add, as you may know, "fx" expressions are reinterpreted at every pixel, so is painfully slow, and unusable for images around 5000x5000 pixels. But it can be a useful prototyping tool.
This is a smarter method of removing outliers than simply replacing each pixel with a mean, which is what blur does. However, it adds time and complexity, and may be overkill.
EDIT: I should add, as you may know, "fx" expressions are reinterpreted at every pixel, so is painfully slow, and unusable for images around 5000x5000 pixels. But it can be a useful prototyping tool.
snibgo's IM pages: im.snibgo.com