isetbio / isetbio_v0.1

Tools for modeling image systems engineering in the human visual system front end
MIT License
7 stars 0 forks source link

The bug in v_sceneFromRGB #39

Closed DavidBrainard closed 9 years ago

DavidBrainard commented 9 years ago

To try to track down why v_sceneFromRGB was giving different answers on the Penn and Stanford machines, I thought it would be clever to add to that script code that computes the value of the offending field by hand, and ask whether this gave the same answer as the value in scene structure (which is itself the same as what is returned by the call to sceneGet(scene,'wangular')).

That led me to conclude that sceneFromFile has a bug. Line 134 of sceneFromFile sets the horizontal field of view (aka wangular) by hand computing the horizontal size of the image in degrees, using the horizontal size as size(I,2).

Here I is the passed image argument, and you might think this would work. But in this case, I is the string giving the image filename, not the image data itself. The image string is 72 characters long, which is then taken as the number of horizontal pixels in the image.

I believe that the Stanford machines get a different answer for wangular because their full path is different form ours, and thus a different FOV is set.

I changed the offending code bit to size(photons,2), since photons contains the image data.

I remade the validation data for v_sceneFromRGB and v_sceneReIllumination. With luck, these may now validate reliably on all machines.

If these validations now pass on Brian's machines, I think this issue can be closed.

wandell commented 9 years ago

Good find. Passes on my machines.