Git Product home page Git Product logo

stbipp's Issues

[test] Implement tests

Is your feature request related to a problem? Please describe.
Well this is pretty clear... Let's implement some tests!

[Image] Add a sampling operator for floating point coordinates

Is your feature request related to a problem? Please describe.
The sampling is made as follow :

auto color = image(1,20) ;
auto sameColor = image(1.01,20.1) ; // equivalent to 'image(int(1.01), int(20.1))'

The color returned in both case will be the same.

Describe the solution you'd like
Using floating point in pixel accessor would perform a linear sampling, a nearest pixel sampling, or a custom made sampler.

Describe alternatives you've considered
A convenient way would be to use a functor to sample the image as follow :

auto color = image.at<LinearSamplingFunctor>(10.01,20.1);

[Image] Set at runtime Image data underlying type

Is your feature request related to a problem? Please describe.
The same way OpenCV is doing it, we can change at runtime the "Color" underlying type.
For the moment it is fixed to Color<float,4>. But what if we want it to be encoded with 3 unsigned chars, or 26 doubles...

It would get rid of the castData() templated member function and will come very handy in some cases.

[Color] Add rvalue operator optimization

Is your feature request related to a problem? Please describe.
The color code handles only lvalues, except for the basic operations such as move assignment and move construction.
But when it comes to Color instantiated only in calculus... Well it is not that optimized.
Let's take a concrete example:

stbipp::Color4f col{0.0f};
col += 1.0f + stbipp::Color4f{1.0f, 2.0f, 3.0f, 4.0f} / 2.0f;

This gives us the right computation result on line 2, although the way the calculus is achieved:

  1. Instantiate Color4f and initialize with parameters {1.0f, 2.0f, 3.0f, 4.0f}
  2. Create a temporary Color4f that stores the result of the division by 2.0f and return it
  3. Create a temporary Color4f that stores the result of the previous operation and add 1.0f to it, then return it.
  4. Add the result to col.

As we can see there are 2 temporary allocation that are avoidable in steps 2 and 3.

Describe the solution you'd like
Well we can use the C++ wonderful rvalue feature, and have operator specialized when we manipulate rvalues in such operations (ref-qualified member functions):

stbipp::Color operator/(Real val) &&
{
  for(auto& val: m_data)
  {
    val /= 2.0;
  }
  return std::move(*this);
}

Et voila, no copy, no useless allocation!

[Exporter] Crop value greater than 1.0 for non hdr format

Describe the bug
When saving an image to a non HDR format, and having channel color values greater than 1.0, the saved image looks... Let's say wrong. If you look at the result image from the example, the fractal patterns shall be using gray shades.

Expected behavior
As the title of the issue let suppose... Crop value greater than 1.0 for non hdr format

Screenshots
test

[build] Add CI to the project

Is your feature request related to a problem? Please describe.
To insure that the project builds on all platforms and at any time, it is now time to implement a continuous integration that perform build operations, and later launch the tests (when implemented).

Describe the solution you'd like
A classic github action implementation will do the trick. Test on PR and add the little label in the readme (it's kinda cool imo)

[Color] Add some clear template parameters for SFINAE

Is your feature request related to a problem? Please describe.
The Color class uses a lot the SFINAE principle in maybe too verbose way

Describe the solution you'd like
Make some type traits that are meaningful to the developer such as :

template<class DataType, class ODataType>
struct is_float_to_integer_cast
{
    static const bool value = (std::is_floating_point<DataType>::value && std::is_integral<ODataType>::value) &&
                              !std::is_same<DataType, ODataType>::value;
};

[doc] Add a short documentation file

Description

A document relating all the features of the library as part of the README or a separate file would be much appreciate for new comers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.