Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
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 (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#include "
mitkConvertGrayscaleOpenCVImageFilter.h
"
14
15
#include <opencv2/imgproc.hpp>
16
17
namespace
mitk
{
18
19
bool
ConvertGrayscaleOpenCVImageFilter::OnFilterImage
( cv::Mat&
image
)
20
{
21
// there is nothing to do if the image is grayscale already
22
if
(image.channels() == 1) {
return
true
; }
23
24
cv::Mat buffer;
25
26
cv::cvtColor(image, buffer, CV_RGB2GRAY, 1);
27
28
// content of buffer should now be the content of image
29
buffer.copyTo(image);
30
31
return
true
;
32
}
33
}
// namespace mitk
mitk::ConvertGrayscaleOpenCVImageFilter::OnFilterImage
bool OnFilterImage(cv::Mat &image) override
Converts given image to grayscale.
Definition:
mitkConvertGrayscaleOpenCVImageFilter.cpp:19
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition:
GeometryOverview.dox:1
mitkConvertGrayscaleOpenCVImageFilter.h
image
mitk::Image::Pointer image
Definition:
GenericFittingMiniApp.cpp:43
Source
Modules
OpenCVVideoSupport
Commands
mitkConvertGrayscaleOpenCVImageFilter.cpp
Generated on Thu Mar 12 2020 10:23:41 for Medical Imaging Interaction Toolkit by
1.8.13