Hello! It's very nice software. I really appreciate it. Thank you! But I have one question. Is there any way to suppress rows from edge_mtf_values.txt and edge_sfr_values.txt that have uncertain measurements of mtf (yellow and red)? I calculate statistics on these values and do not want to consider bad values. I use CLI.
Last edit: Leonid 2020-08-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "measurement quality" indicated by the colour of the annotation (in the Annotated image output) is not directly available, but there is a way to obtain more detailed information that can help you achieve almost a similar result. I have not yet updated the documentation (I am in the middle of adding some fairly large new features), but there is now an "output version" flag. Simply add "-v 2" to your command line arguments, and you will obtain the newer version of edge_mtf_values.txt and edge_sfr_values.txt. These newer versions have a header that documents the various columns, but I will give you a brief set of heuristics:
The "mean CNR" value (column 7 of edge_mtf_values.txt, and column 6 in edge_sfr_values.txt) is the Contrast-to-Noise Ratio, which is similar to an SNR value, but more appropriate in this context. I cannot give you an absolute CNR threshold value for avoiding uncertain measurements, but my rule-of-thumb is that you should keep your CNR above 30. A CNR of above 60 is probably a better target to aim for, although you can approach 200 with some care. I have attached a plot showing the relationship between CNR and the error between the measured SFR and the expected SFR on synthetic edge images. The y-axis units are somewhat arbitrary, but they are more-or-less the RMSE, but weighted towards the lower frequencies (just ignore the fact that there are 3 curves in the plot). Note that the colour of the annotation text (cyan/yellow/red) does not take into account the CNR, since this was developed later, but I consider it a very reliable indicator of measurement quality.
The main indicator of annotation colour is based on a simple heuristic involving the edge angle (column 4 of edge_sfr_values.txt while using the "-v 2" option). If you want to reproduce this, then "yellow" annotations are those with edge angle (col 4) < 1 degree, greater than 44 degrees, or within 1 degree of 26.565 degrees. (but see point 4 below)
Another heuristic to determine the annotation quality is the edge length, which is not currently available directly from the MTF Mapper outputs. The heuristic is to flag edges shorter than 25 pixels as yellow. I will add the edge length to outputs, so you should be able to see them when I release version 0.7.30 later this week.
There is a much better way to assess the impact of edge angle directly: the oversampling factor (col 8 of edge_mtf_values.txt, col 12 of edge_sfr_values.txt, with "-v 2"). Reliable edges will have an oversampling factor of 8.0; anything less indicates that the Nyquist frequency of the measurement is below 4 cycles/pixel, which means that aliasing could become a factor. If you want a more lenient criterion, you can reject edges with an oversampling factor of 4.0 or lower. I have written a blog post on this here, but the short version is that some edge angles (e.g., < 1 degree) do not provide enough oversampling to reliably measure higher spatial frequencies. Using the oversampling factor directly is better (rather than inferring this from the edge angle), because this is a direct measurement of sampling quality, and more importantly, it takes into account the sparser sampling if you use "--bayer green" or "--bayer red" on mosaiced images.
The final heuristic in the annotation colouring process is that an edge with an MTF50 value of 1.0 cycles/pixel or greater is tagged as "N/A", since these should not occur normally. This is easy enough to reproduce on your side.
If you are using raw images, without any demosaicing or sharpening, then you will never see the SFR curve go above a contrast of 1.0, since this is physically impossible. So if you do see such values in the output, you either have demosaicing/sharpening in the pipeline, or you have a bad measurement (some large dust spots near an edge, so some other defect).
To summarise:
a) Edges with an oversampling factor of <= 4.0 should be excluded
b) Edges with a low CNR (below about 30) should be used with care; you probably want to improve your capture conditions to hit a CNR > 60 for improved accuracy
c) I will add the edge length as an additional column in "-v 2" mode, which you should get with version 0.7.30 when I release it later this week.
d) Edges with a contrast value > 1.0 anywhere along the SFR are an indication of a bad measurement, unless you expect some software processing effects (demosaicing, sharpening, using camera-generated JPEG images).
In case it wasn't clear, all of what Frans included in his answer is available from the command line (and a lot of it is not in the GUI).
Ted in Indiana, USA
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can download an early release of version 0.7.30 here;
This update should give you the "edge length" column in edge_sfr_values.txt (and edge_mtf_values.txt" too, if I recall correctly). By the way, you should try the GUI in version 0.7.30, especially when producing an "Annotated" output image, and then clicking on the cyan MTF50 annotation over an edge --- this should give you an SFR plot with a table listing most of these parameters.
Regards,
Frans
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not the maintainer of the Arch package, and I have not tested it on Arch myself yet, but let me know if you have problems, and I will see what I can do.
-Frans
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello! It's very nice software. I really appreciate it. Thank you! But I have one question. Is there any way to suppress rows from edge_mtf_values.txt and edge_sfr_values.txt that have uncertain measurements of mtf (yellow and red)? I calculate statistics on these values and do not want to consider bad values. I use CLI.
Last edit: Leonid 2020-08-13
Hi Leonid,
The "measurement quality" indicated by the colour of the annotation (in the Annotated image output) is not directly available, but there is a way to obtain more detailed information that can help you achieve almost a similar result. I have not yet updated the documentation (I am in the middle of adding some fairly large new features), but there is now an "output version" flag. Simply add "-v 2" to your command line arguments, and you will obtain the newer version of edge_mtf_values.txt and edge_sfr_values.txt. These newer versions have a header that documents the various columns, but I will give you a brief set of heuristics:
To summarise:
a) Edges with an oversampling factor of <= 4.0 should be excluded
b) Edges with a low CNR (below about 30) should be used with care; you probably want to improve your capture conditions to hit a CNR > 60 for improved accuracy
c) I will add the edge length as an additional column in "-v 2" mode, which you should get with version 0.7.30 when I release it later this week.
d) Edges with a contrast value > 1.0 anywhere along the SFR are an indication of a bad measurement, unless you expect some software processing effects (demosaicing, sharpening, using camera-generated JPEG images).
Regards,
Frans
I forgot to mention that I use CLI.
In case it wasn't clear, all of what Frans included in his answer is available from the command line (and a lot of it is not in the GUI).
Ted in Indiana, USA
It's a very helpful answer! Thank you very much!
Hi Leonid,
You can download an early release of version 0.7.30 here;
This update should give you the "edge length" column in edge_sfr_values.txt (and edge_mtf_values.txt" too, if I recall correctly). By the way, you should try the GUI in version 0.7.30, especially when producing an "Annotated" output image, and then clicking on the cyan MTF50 annotation over an edge --- this should give you an SFR plot with a table listing most of these parameters.
Regards,
Frans
Thanks a lot, Frans van den Bergh! I've already added these features to my workflow. By the way, is there any way to run MTF Mapper on Arch Linux?
https://aur.archlinux.org/packages/mtfmapper/
I am not the maintainer of the Arch package, and I have not tested it on Arch myself yet, but let me know if you have problems, and I will see what I can do.
-Frans