[mlpack-git] [mlpack/mlpack] Added the discretize function. Design changes as discussed. (#703)

Tham notifications at github.com
Fri Jun 24 14:12:20 EDT 2016


> +          << 0.341550 << 0.706655 << 0.129553 << arma::endr
> +          << 0.178325 << 0.071330 << 0.939180;
> +
> +  //see how to calculate this efficiently. numpy.dot does this.
> +  CubeType xyz(InImage.n_rows, InImage.n_cols, rgb2xyz.n_cols);
> +
> +  for (size_t i = 0; i < InImage.slice(0).n_elem; ++i)
> +  {
> +    double r = InImage.slice(0)(i);
> +    double g = InImage.slice(1)(i);
> +    double b = InImage.slice(2)(i);
> +    
> +    xyz.slice(0)(i) = 0.430574 * r + 0.341550 * g + 0.178325 * b;
> +    xyz.slice(1)(i) = 0.222015 * r + 0.706655 * g + 0.071330 * b;
> +    xyz.slice(2)(i) = 0.020183 * r + 0.129553 * g + 0.939180 * b;
> +  }

Why not just
```
xyz.slice(0) = 0.430574 * InImage.slice(0) + 0.341550 * InImage.slice(1) + 0.178325 * InImage.slice(2);
xyz.slice(1) = 0.222015 * InImage.slice(0) + 0.706655 * InImage.slice(1) + 0.071330 * InImage.slice(2);
xyz.slice(2) = 0.020183 * InImage.slice(0) + 0.129553 * InImage.slice(1) + 0.939180 * InImage.slice(2);
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/703/files/987f0790f745314a2117a87f28a346b05a8a2a2d#r68438602
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160624/373ccba9/attachment.html>


More information about the mlpack-git mailing list