Skip to content

MSVC compilation error in bilateral_upsampling.hpp #2016

Closed

Description

@denix56

When I compile pcl surface I get this error:
'initializing': cannot convert from 'Eigen::IndexedView<Derived,float,float>' to 'float'

in line 112:

 float dx = float (x - x_w),
                dy = float (y - y_w);

            float val_exp_depth = val_exp_depth_matrix(dx+window_size_, dy+window_size_);

The fix is to make dx and dy int, not float. They are used as indices in matrix and compiler cannot choose the correct overload
Why do dx and dy variables float at all? And how does it work before?

Visual Studio 2015
Eigen 3.3.90 (latest from mercurial repo)

I will create a pull request as soon as my last pull request will be approved

Activity

  1. taketwo commented on Sep 30, 2017

    @taketwo
    Member

    Similar to #1890 #1914.

    Why do dx and dy variables float at all?

    Don't know why, but it makes no sense.

    And how does it work before?

    It still works for me with Eigen 3.3 and GCC 5.4.

    I will create a pull request as soon as my last pull request will be approved

    These two issues are unrelated, I see no reason to make one dependent on another. Also this one is trivial, we can merge it right away.

  2. changed the title [-]MSVC compilation error in bilateral_upsampling.cpp[/-] [+]MSVC compilation error in bilateral_upsampling.hpp[/+] on Sep 30, 2017
  3. denix56 commented on Sep 30, 2017

    @denix56
    ContributorAuthor

    Ok, one more question - d_color is float too. We cast the sum of color channel diffs (int if I understand correctly) to float, then we cast it to Eigen index. Would it be correct to make d_color of Eigen index type and just cast to it only once (sum)?

  4. taketwo commented on Sep 30, 2017

    @taketwo
    Member

    I think that in terms of semantics that piece of code is alright. The d_color variable contains L1 distance between the colors, not an index. And then when we actually perform access into the vector, we say "hey, this distance happens to be indexing into the vector, so let's cast".

    Your code has less casts, so probably marginally faster. But it's a minor thing anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions