PICCANTE  0.4
The hottest HDR imaging library!
white_balance.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_JNI_WHITE_BALANCE_HPP
19 #define PIC_JNI_WHITE_BALANCE_HPP
20 
21 #include "../base.hpp"
22 
23 #include "../filtering/filter_white_balance.hpp"
24 
25 namespace pic {
26 
36 PIC_INLINE int applyWhiteBalanceJNI(std::string imageInPath, std::string imageOutPath, int x, int y, bool bRobust = false)
37 {
38  if(x < 0 || y < 0) {
39  return 0;
40  }
41 
42  Image in;
43  bool bRead = in.Read(imageInPath, LT_NOR_GAMMA);
44 
45  if(bRead) {
46  Image *out = FilterWhiteBalance::execute(&in, x, y, bRobust);
47 
48  bool bWrite = out->Write(imageOutPath.c_str(), LT_NOR_GAMMA, 0);
49 
50  if(!bWrite) {
51  printf("applyWhiteBalanceJNI: the image could not be written.\n");
52  }
53 
54  if(out != NULL) {
55  delete out;
56  }
57 
58  return bWrite ? 1 : 0;
59  } else {
60  printf("applyWhiteBalanceJNI: the image could not be read.\n");
61  return 0;
62  }
63 }
64 
65 } // end namespace pic
66 
67 #endif /* PIC_JNI_WHITE_BALANCE_HPP */
68 
#define PIC_INLINE
Definition: base.hpp:33
The Image class stores an image as buffer of float.
Definition: image.hpp:60
static Image * execute(Image *imgIn, float *white_color, Image *out)
execute
Definition: filter_white_balance.hpp:162
Definition: dynamic_range.hpp:29
Definition: bilateral_separation.hpp:25
bool Read(std::string nameFile, LDR_type typeLoad)
Read opens an Image from a file on the disk.
bool Write(std::string nameFile, LDR_type typeWrite, int writerCounter)
Write saves an Image into a file on the disk.
PIC_INLINE int applyWhiteBalanceJNI(std::string imageInPath, std::string imageOutPath, int x, int y, bool bRobust=false)
applyWhiteBalanceJNI
Definition: white_balance.hpp:36