Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC compilation error in bilateral_upsampling.hpp #2016

Closed
denix56 opened this issue Sep 30, 2017 · 3 comments
Closed

MSVC compilation error in bilateral_upsampling.hpp #2016

denix56 opened this issue Sep 30, 2017 · 3 comments

Comments

@denix56
Copy link
Contributor

denix56 commented Sep 30, 2017

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

@taketwo
Copy link
Member

taketwo commented Sep 30, 2017

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.

@denix56 denix56 changed the title MSVC compilation error in bilateral_upsampling.cpp MSVC compilation error in bilateral_upsampling.hpp Sep 30, 2017
@denix56
Copy link
Contributor Author

denix56 commented Sep 30, 2017

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)?

@taketwo
Copy link
Member

taketwo commented Sep 30, 2017

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants