Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
Home
Manual
API Reference
Download
Bugzilla
Groups
Namespace List
Class List
File List
Examples
File List
File Members
mitkConvertGrayscaleOpenCVImageFilter.cpp
Go to the documentation of this file.
1
/*===================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center,
6
Division of Medical and Biological Informatics.
7
All rights reserved.
8
9
This software is distributed WITHOUT ANY WARRANTY; without
10
even the implied warranty of MERCHANTABILITY or FITNESS FOR
11
A PARTICULAR PURPOSE.
12
13
See LICENSE.txt or http://www.mitk.org for details.
14
15
===================================================================*/
16
17
#include "
mitkConvertGrayscaleOpenCVImageFilter.h
"
18
19
#include "cv.h"
20
21
namespace
mitk
{
22
23
bool
ConvertGrayscaleOpenCVImageFilter::OnFilterImage
( cv::Mat& image )
24
{
25
// there is nothing to do if the image is grayscale already
26
if
(image.channels() == 1) {
return
true
; }
27
28
cv::Mat buffer;
29
30
cv::cvtColor(image, buffer, CV_RGB2GRAY, 1);
31
32
// content of buffer should now be the content of image
33
buffer.copyTo(image);
34
35
return
true
;
36
}
37
}
// namespace mitk
mitk::ConvertGrayscaleOpenCVImageFilter::OnFilterImage
bool OnFilterImage(cv::Mat &image) override
Converts given image to grayscale.
Definition:
mitkConvertGrayscaleOpenCVImageFilter.cpp:23
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition:
GeometryOverview.dox:1
mitkConvertGrayscaleOpenCVImageFilter.h
git
MITK
Modules
OpenCVVideoSupport
Commands
mitkConvertGrayscaleOpenCVImageFilter.cpp
Generated on Fri Feb 3 2017 20:51:55 for Medical Imaging Interaction Toolkit by
1.8.9.1