MYNT-EYE-S-SDK/src/api/processor/disparity_normalized_processor.cc

53 lines
1.6 KiB
C++
Raw Normal View History

2018-05-10 14:46:34 +08:00
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2018-04-27 09:58:53 +08:00
#include "api/processor/disparity_normalized_processor.h"
2018-04-28 13:26:46 +08:00
#include <opencv2/imgproc/imgproc.hpp>
2018-04-27 09:58:53 +08:00
#include <glog/logging.h>
2018-06-01 10:32:36 +08:00
#include <utility>
2018-04-27 09:58:53 +08:00
MYNTEYE_BEGIN_NAMESPACE
2018-06-01 10:32:36 +08:00
DisparityNormalizedProcessor::DisparityNormalizedProcessor(
std::int32_t proc_period)
: Processor(std::move(proc_period)) {
VLOG(2) << __func__ << ": proc_period=" << proc_period;
2018-04-27 09:58:53 +08:00
}
DisparityNormalizedProcessor::~DisparityNormalizedProcessor() {
VLOG(2) << __func__;
}
std::string DisparityNormalizedProcessor::Name() {
return NAME;
}
Object *DisparityNormalizedProcessor::OnCreateOutput() {
2018-04-28 13:26:46 +08:00
return new ObjMat();
2018-04-27 09:58:53 +08:00
}
2018-04-28 13:37:25 +08:00
bool DisparityNormalizedProcessor::OnProcess(
2018-04-27 09:58:53 +08:00
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
2018-04-28 13:26:46 +08:00
const ObjMat *input = Object::Cast<ObjMat>(in);
ObjMat *output = Object::Cast<ObjMat>(out);
cv::normalize(input->value, output->value, 0, 255, cv::NORM_MINMAX, CV_8UC1);
2018-04-28 13:37:25 +08:00
// cv::normalize maybe return empty ==
return !output->value.empty();
2018-04-27 09:58:53 +08:00
}
MYNTEYE_END_NAMESPACE