Home | History | Annotate | Download | only in colorchecker
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef WHITEBALANCETEST_H
     18 #define WHITEBALANCETEST_H
     19 
     20 #include <vector>
     21 #include <string>
     22 
     23 #include "imagetesthandler.h"
     24 
     25 class WhiteBalanceTest : public ImageTestHandler {
     26   public:
     27     WhiteBalanceTest() : ImageTestHandler() {}
     28     WhiteBalanceTest(int debugHeight, int debugWidth) :
     29             ImageTestHandler(debugHeight, debugWidth) {}
     30     ~WhiteBalanceTest() {}
     31 
     32     void addDataToList(const std::string &mode,
     33                        const std::vector<Vec3f>* checkerColors) {
     34         mMode = mode;
     35         mCheckerColors = *checkerColors;
     36         delete checkerColors;
     37     }
     38 
     39     void processData();
     40 
     41     int getCorrelatedColorTemp() const {
     42         return mCorrelatedColorTemp;
     43     }
     44 
     45     int getAutoTemp();
     46 
     47   private:
     48     int findCorrelatedColorTemp(const Vec3f &whitePoint);
     49     Vec3f initializeFromRGB(const Vec3f &rgb);
     50     float convertToLinear(float color);
     51 
     52     std::string mMode;
     53     std::vector<Vec3f> mCheckerColors;
     54     std::vector<Vec3f> mCheckerXyzColors;
     55     std::vector<Vec3f> mXyzColorsDaylight;
     56     int mCorrelatedColorTemp;
     57 };
     58 
     59 #endif
     60