123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- // This file is part of HDRip.
- //
- // HDRip is free software: you can redistribute it and/or modify it
- // under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // HDRip is distributed in the hope that it will be useful, but
- // WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with HDRip. If not, see <https://www.gnu.org/licenses/>.
- //
- // HDRip project
- // Author : Rémi Synave
- // Contact : remi.synave@univ-littoral.fr
- #include "pch.h"
- #include <iostream>
- #include <chrono>
- #include <cstdlib>
- #include <vector>
- #include <ctime>
- #include <Eigen/Core>
- #include <unsupported/Eigen/Splines>
- #include "ImageHDR.hpp"
- #include "YCurve.hpp"
- #include "Conversion.hpp"
- #include "all_processings.hpp"
- float* exposure(float* data, unsigned int width, unsigned int height, float exposure)
- {
- ImageHDR img(data, width, height);
- img.exposure(exposure);
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* contrast(float* data, unsigned int width, unsigned int height, float constrast)
- {
- ImageHDR img(data, width, height);
- img.contrast(constrast);
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* yCurve(float* data, unsigned int width, unsigned int height, float yCs, float yCb, float yCm, float yCw, float yCh)
- {
- ImageHDR img(data, width, height);
- img.yCurve(yCs, yCb, yCm, yCw, yCh);
- img.non_linear_to_linear();
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* lightnessMask(float* data, unsigned int width, unsigned int height, bool lms, bool lmb, bool lmm, bool lmw, bool lmh)
- {
- ImageHDR img(data, width, height);
- img.lightnessMask(lms, lmb, lmm, lmw, lmh);
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* saturation(float* data, unsigned int width, unsigned int height, float saturation)
- {
- ImageHDR img(data, width, height);
- img.saturation(saturation);
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* colorEditor(float* data, unsigned int width, unsigned int height, float ce_sel_light_l, float ce_sel_light_h, float ce_sel_chr_l, float ce_sel_chr_h, float ce_sel_hue_l, float ce_sel_hue_h, float ce_tol, float ce_edit_hue, float ce_edit_expo, float ce_edit_con, float ce_edit_sat, bool ce_mask)
- {
- ImageHDR img(data, width, height);
- float sel_light[2] = { ce_sel_light_l, ce_sel_light_h };
- float sel_chr[2] = { ce_sel_chr_l, ce_sel_chr_h };
- float sel_hue[2] = { ce_sel_hue_l, ce_sel_hue_h };
- img.colorEditor(sel_light, sel_chr, sel_hue, ce_tol, ce_edit_hue, ce_edit_expo, ce_edit_con, ce_edit_sat, ce_mask);
- float* ret = new float[width * height * 3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
- return ret;
- }
- float* full_process(float* data, unsigned int width, unsigned int height,
- float exposure,
- float contrast,
- float yCs, float yCb, float yCm, float yCw, float yCh,
- bool lms, bool lmb, bool lmm, bool lmw, bool lmh,
- float saturation,
- float ce_sel_light_l, float ce_sel_light_h, float ce_sel_chr_l, float ce_sel_chr_h, float ce_sel_hue_l, float ce_sel_hue_h, float ce_tol, float ce_edit_hue, float ce_edit_expo, float ce_edit_con, float ce_edit_sat, bool ce_mask)
- {
- ImageHDR img(data, width, height);
- // ******************************************
- img.exposure(exposure);
- // ******************************************
- // ******************************************
- img.contrast(contrast);
- // ******************************************
- // ******************************************
- img.yCurve(yCs, yCb, yCm, yCw, yCh);
- // ******************************************
- // ******************************************
- img.lightnessMask(lms, lmb, lmm, lmw, lmh);
- // ******************************************
- // ******************************************
- img.saturation(saturation);
- // ******************************************
- // ******************************************
- float sel_light[2] = {ce_sel_light_l, ce_sel_light_h};
- float sel_chr[2] = {ce_sel_chr_l, ce_sel_chr_h};
- float sel_hue[2] = {ce_sel_hue_l, ce_sel_hue_h};
- img.colorEditor(sel_light, sel_chr, sel_hue, ce_tol, ce_edit_hue, ce_edit_expo, ce_edit_con, ce_edit_sat, ce_mask);
- // ******************************************
- float *ret = new float[width*height*3];
- memcpy(ret, img.data, width * height * 3 * sizeof(float));
-
- return ret;
- }
|