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

convTri is not correctly called when calculating the pyramid #69

Closed
JN-Jones opened this issue May 18, 2018 · 2 comments
Closed

convTri is not correctly called when calculating the pyramid #69

JN-Jones opened this issue May 18, 2018 · 2 comments
Labels

Comments

@JN-Jones
Copy link

This is the matlab variant:

% compute image pyramid [approximated scales]
for i=isA
  iR=isN(i); sz1=round(sz*scales(i)/shrink);
  for j=1:nTypes, ratio=(scales(i)/scales(iR)).^-lambdas(j);
    data{i,j}=imResampleMex(data{iR,j},sz1(1),sz1(2),ratio); end
end

% smooth channels, optionally pad and concatenate channels
for i=1:nScales*nTypes, data{i}=convTri(data{i},smooth); end

and this is yours:

    util::ParallelHomogeneousLambda harness = [&](int j) {
        const int i = isA[j];

        int iR = isN[i - 1];
        cv::Size sz1 = round(cv::Size2d(sz) * scales[i - 1] / double(shrink));
        for (int j = 0; j < nTypes; j++)
        {
            double ratio = std::pow(scales[i - 1] / scales[iR - 1], -lambdas[j]);
            imResample(data[iR - 1][j], data[i - 1][j], sz1, ratio);
        }
        for (auto& img : data[i - 1])
        {
            convTri(img, img, smooth, 1);
        }
    };

cv::parallel_for_({ 0, int(isA.size()) }, harness);

However isA may be empty (it was in my case) which results in convTri not called at all. However the matlab code always applies convTri to all channels. So the convTri needs to be outside of the parallel_for call, maybe in it's own.

headupinclouds added a commit that referenced this issue May 18, 2018
* issue described here #69 : convTri was skipped in cases where `isA` is empty
* use standard c++11 style opencv cv::parallel_for_ on lambdas
* use a random scale scheduler (should be better than uniform slices)
@headupinclouds
Copy link
Contributor

Thanks. Fix applied in #70 , testing ...

I'll make an issue to add some kind of pixel level pyramid tests in place for c++ vs matlab. I think we can store ACF output from matlab, possibly in *.mat format, and load it via cvmatio for comparisons.

@headupinclouds
Copy link
Contributor

Added #71

headupinclouds added a commit that referenced this issue May 18, 2018
* run convTri on all scales/types in all cases

* issue described here #69 : convTri was skipped in cases where `isA` is empty
* use standard c++11 style opencv cv::parallel_for_ on lambdas
* use a random scale scheduler (should be better than uniform slices)

* bump version

* bump patch version : v0.1.10
* relocate create_random_indices (move out of public header)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants