Jump to content
UltravioletPhotography

Program to Label Dmitry's Solar Lens Tests


Recommended Posts

Andy Perrin

I thought Dmitry's spectroscopic method of classifying lenses was generally a good idea but badly in need of labels for the images. So I have written a MATLAB script to semi-automatically label the lines. It attempts to detect the lines by finding the luminance as a function of position, then hunting for local minima. The user must supply at least two wavelengths corresponding to the spectral lines, and then the program does the rest of the work.

 

Here is a sample using some of the zwb3+qb21 stack spectrograms of his more successful tests.

 

Olympus 25 f1.8 lens

post-94-0-93945800-1528222143.png

 

Industar-50-2 50mm f3.5 lens

post-94-0-91783000-1528222150.png

 

Lomo T-43 40mm f4

[Editedx2 - see comments below]

post-94-0-58323700-1528222156.png

 

post-94-0-39238500-1528225965.png

 

The MATLAB script is here. To use it,

1) change the lens name in line 9

2) set hideNumbers = 0; in line 10

3) Using the spectral line markings that appear when you run the code, set

idx = [line marking numbers];

lambdaKnown = [wavelengths of the known spectral lines ];

in lines 17 and 18.

4) Run the code again with hideNumbers=1 to make the spectral line marking numbers invisible again.

 

As needed, adjust the threshold parameter on line 11 to a higher or lower value to decide when to throw away lines due to the image being too dark. All detected spectral lines with intensity below the threshold value (which ranges from 0 to 1) are discarded the next time you run the program.

 

Edits:

1) 6/4/18 fixed Dmitry's name (oops) and also the Lomo graph numbers.

2) 6/5/18 Redid the algorithm slightly to include Andrea's suggestion of moving the labels up and down so they don't overlap. Also increased font size for easier reading by tired eyes. Fixed this post. The new code is at the link above and replaces the former code.

3) 6/5/18 Moved all the adjustable parameters to the top of the code, for ease of access. Added 2nd copy of Lomo lens.

Link to comment

Wow nice!

Andy, which base lines was used for T-43 lens? I see that the 471nm line was placed at 486nm position on the other two lenses.

 

Edit:

F-line is 486nm, it is correct label.

B-line is 686.7nm, it detected properly too.

 

T-43 labels need to be verified.

Link to comment

Labels on Oly25 and I-50 are fine.

 

Labels on T-43 need to be fixed. 471 to 486, 376 to 372, 384 to 382. Not sure, maybe 640 to 687.

Link to comment

Does your code also work in either GNU Octave, or freemat?

These are the free Matlab alternatives, I know about.

I once used Maple. But that was almost a lifetime ago when I was at Waterloo.

 

I still need to learn R, I was using SAS. But keeping up with subscription was hard. Again that seems like a lifetime ago.

 

Update just read about Scilab on Wikipedia. Seems it has a code transfer tool as its similar to MATLAB. Maybe this will work better.

 

I really like these labels. It adds calibration to spectral determination. I had some sun yesterday and was able to do a camera sensitivity test using the 1000 lines/mm grading on a Pinhole pro with my full spectrum E510, Em1 and SD14. Would be good to know where I am looking. I teste the Baader venus filter, the zwb1/s8612 and u330/S8612 stacks as well. So I will have to look closely to see if I see these similar dark lines. The grading does not have the compression of the prism. So I may still need to make the prism assebly I intended with the quartz prism from Amazon I got.

Thank you for this.

David

Link to comment
Andy Perrin
I made a lot of use of built in MATLAB functions for finding local minima and for smoothing the data to reduce noise. I’m not sure if those functions are in Octave or others. You could probably write your own versions of the built in ones but it would be some work I think.
Link to comment

Very cool, Andy.

Man, MATLAB is so great. I love programming.

In addition to the main MATLAB, do you have any of the add-ons? Isn't there something for Images?

 

When one line is close to another, is there anyway to make one label taller the other. (Heh-heh. A programming challenge.)

 

I am figuring out how best to collect Dmitry's spectra into one place. We don't want too many sections here, but a Lens Spectra section would be perhaps useful. All lens transmission charts and spectra could be placed into it.

 

And I'm going to help Dmitry format the Index into a table form. (Our forum software is a bit lame - not much offered for easily making tables.)

 

****

 

David you have a typo. grading --> grating

And thx for mentioning the free MATLAB alternatives. I always like to know about that kind of open source app.

Link to comment
Andy Perrin
In addition to the main MATLAB, do you have any of the add-ons? Isn't there something for Images?

There is a toolbox for images, and I have it, but this code does not depend on any add-on toolboxes (I was careful about that!).

 

When one line is close to another, is there anyway to make one label taller the other. (Heh-heh. A programming challenge.)

Yes, this was quick-and-dirty. If people want I can polish it a bit.

 

The free MATLAB alternatives are unfortunately worth what you pay for them, in my opinion. I tried Octave once, and it crashed constantly. Also they are missing most of the built-in stuff that makes MATLAB programming efficient. Without that, I would just write in C and use libraries, which runs much faster.

Link to comment
Andy Perrin

Andy, I added spectrum from another copy of T-43 just in case more lines could be extracted.

Yep, and they could be! The scale becomes more accurate as I add more known lines also (since the interpolation improves).

Link to comment

And the question is - what point can we call a cut-off?

 

Interesting, it found invisible lines 464 and 470, but not found at least 3 visible lines between 393 and 431.

Link to comment
Andy Perrin
Don’t read into that. Remember I have lots of thresholds for things like minimum brightness, smoothing, and how deep the minimum is. The point here is NOT to find all lines, it is to put the scale on the image.
Link to comment
Andy Perrin
I don’t think you can define a cutoff from this method. Remember it depends on exposure and filter stack and especially the latter is not one you can use for photography. Your stack leaks IR badly.
Link to comment

So I need to find a filter to block 360+nm and push exposure little more?

 

What is the typical sensitivity curve of the sensor on the UV range?

Link to comment
Andy Perrin

So I need to find a filter to block 360+nm and push exposure little more?

 

What is the typical sensitivity curve of the sensor on the UV range?

Cadmium can tell you a good stack to use. He is the expert (he also sells them as UVIRoptics).

 

For the sensitivity curve, that depends on your type of sensor (Bayer or Foveon) and probably to a lesser degree on camera brand. Jonathan has been testing both I believe.

Foveon sensor type:

http://www.ultravioletphotography.com/content/index.php/topic/2770-foveon-sensor-transmission-charts/page__view__findpost__p__21821

Some results for a Bayer type:

http://www.ultraviol...dpost__p__20116

Link to comment
  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...