libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CRNImageLuv.cpp
Go to the documentation of this file.
1 /* Copyright 2008-2015 INSA Lyon
2  *
3  * This file is part of libcrn.
4  *
5  * libcrn is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libcrn is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: CRNImageLuv.cpp
19  * \author Loris EYNARD, Yann LEYDIER
20  */
21 
22 #include <CRNImage/CRNImageLuv.h>
23 #include <CRNImage/CRNImage.h>
24 #include <CRNi18n.h>
25 
26 using namespace crn;
27 
29 {
30  auto res = ImageDoubleGray(img.GetWidth(), img.GetHeight());
31  for (auto tmp : Range(img))
32  res.At(tmp) = img.At(tmp).l;
33  return res;
34 }
35 
37 {
38  auto res = ImageDoubleGray(img.GetWidth(), img.GetHeight());
39  for (auto tmp : Range(img))
40  res.At(tmp) = img.At(tmp).u;
41  return res;
42 }
43 
45 {
46  auto res = ImageDoubleGray(img.GetWidth(), img.GetHeight());
47  for (auto tmp : Range(img))
48  res.At(tmp) = img.At(tmp).v;
49  return res;
50 }
51 
52 
ScalarRange< T > Range(T b, T e)
Creates a range [[b, e[[.
Definition: CRNType.h:257
ImageDoubleGray UChannel(const ImageLuv &img)
Definition: CRNImageLuv.cpp:36
std::vector< pixel_type >::reference At(size_t x, size_t y) noexcept
Returns a reference to a pixel.
Definition: CRNImage.h:224
size_t GetHeight() const noexcept
Definition: CRNImage.h:74
Image< double > ImageDoubleGray
double Grayscale image class
ImageGray VChannel(const ImageHSV &img)
Create an image from the value channel.
Definition: CRNImageHSV.cpp:53
size_t GetWidth() const noexcept
Definition: CRNImage.h:72
ImageDoubleGray LChannel(const ImageLab &img)
Definition: CRNImageLab.cpp:27