My tamron lens is not automatically detected. [solved]

Thanks a lot for your answer but now i am in a complete mess.

I can provide the required exif data, but don’t know where to inform the problem in order to try get it fixed.

Under darktable photos with this lens are showed as take with a lens “255”.
It seems that the library is using the LensType under CanonCs exif data (makernotes?).

But there are other fields listing it as 0xa434 Photo LensModel Ascii 40 TAMRON SP 70-200mm F/2.8 Di VC USD A009

In the lensfun database there is not the trailing A009 in the nomenclature.
May be that the problem?

UPDATED:

under share/lensfun/version1 there is the slr_tamron.xml file.

In it you can find the lens with exactly the same name that appears in exif as LensModel, with the A009 at the end.
Just one difference TAMRON appears capitalized in the lens model instead of Tamron.

I have changed the file, to save it as TAMRON, close and opened darktable, but the problem remains.

The link posted by @claes tells you what the ~/.exiv2 file is. Did you read that thread? I think all your answers are in there.

Yes I read it, but it seems it is talking about Linux.

It seems to be a kind of configuration file. But I am not able to find that file in windows.

Update:
Ok I could find at last where it should be in windows, but it is not created by default, that is why I could not find it.

So create the file with the information for your lens, right?

I have been trying.
no way it does not work.

Under windows the file seems to be in c:\users\yourusername\exiv2.ini

Lensfun database identifies this lens as follows

    <maker>Tamron</maker>
    <model>Tamron SP 70-200mm f/2.8 Di VC USD A009</model>
    <model lang="en">Tamron SP 70-200mm f/2.8 Di VC USD</model>

I was not sure if A009 is needed or not.

As I have reported earlier, using exiv2 to get lenstype and model gives you
0x0016 CanonCs LensType Short 1 255
0x0095 Canon LensModel Ascii 74 TAMRON SP 70-200mm F/2.8 Di VC USD A009
0xa434 Photo LensModel Ascii 40 TAMRON SP 70-200mm F/2.8 Di VC USD A009

So I have tried every combination of them

[canon]
255=Tamron SP 70-200mm f/2.8 Di VC USD

[canon]
255=Tamron SP 70-200mm f/2.8 Di VC USD A009

[canon]
255=TAMRON SP 70-200mm f/2.8 Di VC USD A009

with no success under darktable.

I have closed and opened darkatable each time with no success.

The difference is that when i run now exiv2 it reports LensType for the provided name and not as 255

Exif.CanonCs.LensType Short 1 Tamron SP 70-200mm f/2.8 Di VC USD

So it seems that exiv2 is reading the exiv2.ini file and working, but not darktable.

May be it only works in the command line tool and not the library.

But darktable reports lens as 255 each time.

I can provide a raw file if demanded in order to see if it just a problem with windows or it happens in Linus too.

In a moment of inspiration, I have deleted all the photos from the database and reimported them

Now when I open one of the photos taken with this lens it recognizes it correctly.

This is the current config of the exiv2.ini file, in case it helps somebody:

[canon]
255=Tamron SP 70-200mm f/2.8 Di VC USD A009

I have no problem now with that exiv2.ini file but others that have the same lens in a canon EOS camera (APS in case that matters) may have that problem.
If anybody is able to report it to the appropiate place in order to get this solved for future versions it would be great.

1 Like

It isn’t clear to me if lens fun also needs the camera body type to correctly use the lens correction. e.g., if the lens correction for a lens was done with a full frame camera, will the same correction be applicable to an APC camera? Maybe someone can let me know :stuck_out_tongue:

Yes, lens corrections made in a FF camera can be used in an APS sensor (not the reverse).
The aps sensor is just as a crop of the image, you just use the center of the image, but the lens behaves exactly the same.

Indeed as I could read in the lensfun database, lens correction for this lens has been made with a 6D camera which is FF.
I don’t know if lensfun can have any issue with that (it shouldn’t).

Most lens corrections in other software are made with data taken with a FF EOS camera and applied to aps.

when programming using the lensfun API, you create a lfModifier class that gathers all the information needed by the various correction algorithms. One of the things the programmer needs to pass to lfModifier is the mount crop factor, and the documentation says this about it:

imgcrop: The crop factor for the image to be processed. The distortion models will take this into account if lens models were measured on a camera with a different crop factor.

So us schlep programmers have to go rooting through the metadata for the crop factor…

An update to this problem.

I have reported it to darktable developers.

They don’t seem to care much about lenses not being correctly identified.
Somebody has just answered that it is an exiv2 problem (yes but darktable uses exiv2 and users do not neccesarily know each internal detail of the software).

I have tried to open an issue in exiv2.
They have answered that it is a pity that I were directed to report it to exiv2 developers.

It seems that 255 just means that the lens is not known.
From the answer I understand that when the camera firmware does not identify the lens it uses 255 as lens id.
So canon assigns that ID to every lens that is not manufactured by them.

Exiv2 seems to try to identify the lens in other ways (there are other EXIF lensModel that correctly identify the lens).
But if it cannot, then they return 255.

It is clear that there is a bug in exiv2 identifying this lens as they cannot recognize a lens that is clearly identied int he exif data.

But they don’t point you to any usefull info or ask you to provide infor in order to get it fixed for future versions, so I don’t expect this fixed.

The response has been quite dissapointing. I had expected a place where you could provide info in order to fix the lenses that cannot be correctly identified.
Given the responses, it is not strange that years after this lens has been released to the market, it is not correctly identified.

I you use the 255 to tamron mapping configuration, you will map any lens that is not identified by exiv2 to the lens you have mapped in your config file.

You were provided the information about the config file in the third response, by me, and that is disappointing? Exiv2 is under-manned. You expected someone to do the work for you, but that is not the way open source software works.

That solution is a patch, not a solution.

As I have explained right now 255 IS NOT the correct lens id for the Tamron lens

I expect that a program or library that says is able to automatically identify your lens do that : automatically identify your lens.

And when it fails to do so, it is a bug or misfunction of the program/library.
So I expect that users can contribute with info to solve the problem and in this case help to fix incorrectly identified lenses for future versions.

If I just correct it in my config file for me and do not provide feedback at all the problem will remain for upcoming releases.

That is how OPENSOURCE WORKS: if there is a problem, users provide feedback about the problem and are provided instructions about which tests they can do or what info they can provide to fix it.
Of course developers do that at their own pace you cannot expect every problem fixed inmediatly (neither in commercial software).

I don’t expect anybody to do my work.
Your response was not clear enough for me because it missed that I was using windows and not linux, and because a user of darktable does not know which other libraries/tools uses darktable.

But thanks to your contribution and others I could managed to find where the config file was.

I was convinced that the 255 was the correct ID for this lens, so I tried to provide it to be fix.

But it is not, as I was told 255 just means than your lens was not correctly identified.

Any lens not correctly identified would be assigned this ID. If you have two of this lenses you have a problem.

So making this change in my config is only a patch, that may work if you have only one lens with this problem and it won’t be fixed in the future meanwhile the algorithm that detects this lens is not changed.

I have used several other software that has no problem identifying the lens.
So yes, it is a software problem.

@ariznaf, could you post a raw file from your camera shot with that lens? It can just be a picture of the inside face of your lens cover; I just want to inspect the metadata recorded by the camera for that lens.

Of course, no problem nobody is going to steal may photos :smile:
The first I have seen with this lens.
80D-0270.CR2 (33.5 MB)

I was not sure if I could post a raw here, but you can.

Robin mills (one of the exiv2 developer) has answered me.

It seems a common problem with some lenses, it seems it is not so easy to fix problems with lens identification.
There is no standard way of doing things.
Sometimes Canon puts a unique ID of lenses they do not manufacture, others not.

It seems there are going to be in depth changes in the future to exiv2 in order to give the community a way to fix the lenses that are no correctly identified.
In his own words, exiv2 is mainly a way to read exif data and the goal to identify a lens correctly is not easy.

1 Like

Thanks!

Okay, this give me the chance to use my improved exiftool incorporation in rawproc. I opened your image, and used my EXIF dialog to run ‘exiftool -G -S -n’ against the file. Then, I filtered on the word ‘lens’ (case insensitive) to get all the tags related to the lens. Here’s the result:

[EXIF] LensInfo: 70 200 0 0
[EXIF] LensModel: TAMRON SP 70-200mm F/2.8 Di VC USD A009
[EXIF] LensSerialNumber: 0000000000
[MakerNotes] LensType: 255
[MakerNotes] LensDriveNoAF: 1
[MakerNotes] RetractLensOnPowerOff: 0
[Composite] Lens: 70
[Composite] LensID: 255
[Composite] Lens35efl: 108.800732768397

The -n switch tells exiftool not to ‘make pretty’ the values, just display them straight from the file. Sooo… Eureka! There is a string value with the lens nomenclature, in the EXIF data at that. I say it that way, because this appears to be a recent phenomenon with some camera manufacturers, actually using the standard EXIF tags to report on attached lenses. For some, they’ll put it in their priprietary MakerNotes; others, will just provide some other encoding like an ID.

To be complete, I did the same cull with exiv2:

glenn@caliente:~/Downloads$ exiv2 -pa 80D-0270.CR2  |grep Lens
80D-0270.CR2: (No IPTC data found in the file)
Exif.CanonCs.LensType                        Short       1  255
Exif.CanonCs.Lens                            Short       3  70.0 - 200.0 mm
Exif.Canon.LensModel                         Ascii      74  TAMRON SP 70-200mm F/2.8 Di VC USD A009
Exif.Photo.LensSpecification                 Rational    4  70/1 200/1 0/1 0/1
Exif.Photo.LensModel                         Ascii      40  TAMRON SP 70-200mm F/2.8 Di VC USD A009
Exif.Photo.LensSerialNumber                  Ascii      11  0000000000

So, the darktable could use the Exif.Photo.LensModel tag to look up the lens in lensfun, in this particular case.

Edit: So this would be a question for exiv2 folk: By chance, are you populating the Exif.Photo.LensModel with the Exif.Canon.LensModel contents, or is that straight from the camera?

Doesn’t this mean that exiv2 is working properly? It extracts all the useful information from the metadata.

Therefore it seems like the raw processor should recognize the right tag (the Exif.Photo.LensModel), forward it to lensfun and obtain the right information. And that currently fails. No?

If the raw processor is using exiv2, yes.

@ariznaf I’ve commented on your darktable GitHub issue, pointing them to this thread. I believe the issue is clearly with how darktable handles the extracted metadata. Not sure if this can be changed easily though…

Had you fully read the link, you’d see there is a command to show the location of the .exiv2 file.

@ggbutcher
Yes, the lens is correctly identified in other fields as I have said.

The question has been made, I have put an issue in darktable and in exiv2.

Each one says it is the other part problem, more or less (you can read more about it).

This is the issue in exiv2.

This in darktable

As @Thanatomanic points out, exiv2 has correctly done its job of providing exif data.

The tamron is not a canon lens, so in canon’s makersnote propietary exif data it identifies the lens as unknown (it sounds reasonable as canon ignores any lens that it has not manufactured for lens corrections or any other lens related processing, but it seems that for some lenses they provide an ID).

255 (-1 in you interpret is a a signed int) just means the lens has not been identified by canon firmware.
And other exif fields identify the lens correctly.

But it seems that till some time ago exiv2 tries to go a step forward from that and identify the lens and return a name for the lens doing some magic.

But it seems that they have dropped that some time ago there is an article of exiv2 developer saying he has dropped the towel.

To patch the 255 problem they provided the exiv2 config file to map it to a name manually.

But that is just a patch.
If they are not going to provide that kind of guessing magic, there are going to be more and more lenses identified as 255.

Well I cannot provide any more info or help about this, I man not a developer of any of the programs, just tried to help fix a problem with lens identification.