Commit a301132a03ff54af793f1041a0c5bfc80dfaf816
1 parent
e39e7e60
forgot to remove these plugins previously
Showing
3 changed files
with
0 additions
and
216 deletions
openbr/plugins/gui/drawopticalflow.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 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 | -#include <openbr/plugins/openbr_internal.h> | |
| 18 | -#include <openbr/core/opencvutils.h> | |
| 19 | - | |
| 20 | -#include <opencv2/imgproc.hpp> | |
| 21 | - | |
| 22 | -using namespace cv; | |
| 23 | - | |
| 24 | -namespace br | |
| 25 | -{ | |
| 26 | - | |
| 27 | -/*! | |
| 28 | - * \ingroup transforms | |
| 29 | - * \brief Draw a line representing the direction and magnitude of optical flow at the specified points. | |
| 30 | - * \author Austin Blanton \cite imaus10 | |
| 31 | - */ | |
| 32 | -class DrawOpticalFlow : public UntrainableTransform | |
| 33 | -{ | |
| 34 | - Q_OBJECT | |
| 35 | - Q_PROPERTY(QString original READ get_original WRITE set_original RESET reset_original STORED false) | |
| 36 | - BR_PROPERTY(QString, original, "original") | |
| 37 | - | |
| 38 | - void project(const Template &src, Template &dst) const | |
| 39 | - { | |
| 40 | - const Scalar color(0,255,0); | |
| 41 | - Mat flow = src.m(); | |
| 42 | - dst = src; | |
| 43 | - if (!dst.file.contains(original)) qFatal("The original img must be saved in the metadata with SaveMat."); | |
| 44 | - dst.m() = dst.file.get<Mat>(original); | |
| 45 | - dst.file.remove(original); | |
| 46 | - foreach (const Point2f &pt, OpenCVUtils::toPoints(dst.file.points())) { | |
| 47 | - Point2f dxy = flow.at<Point2f>(pt.y, pt.x); | |
| 48 | - Point2f newPt(pt.x+dxy.x, pt.y+dxy.y); | |
| 49 | - line(dst.m(), pt, newPt, color); | |
| 50 | - } | |
| 51 | - } | |
| 52 | -}; | |
| 53 | - | |
| 54 | -BR_REGISTER(Transform, DrawOpticalFlow) | |
| 55 | - | |
| 56 | -} // namespace br | |
| 57 | - | |
| 58 | -#include "gui/drawopticalflow.moc" |
openbr/plugins/imgproc/sift.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 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 | -#include <opencv2/features2d.hpp> | |
| 18 | - | |
| 19 | -#include <openbr/plugins/openbr_internal.h> | |
| 20 | - | |
| 21 | -using namespace cv; | |
| 22 | - | |
| 23 | -namespace br | |
| 24 | -{ | |
| 25 | - | |
| 26 | -/*! | |
| 27 | - * \ingroup transforms | |
| 28 | - * \brief Specialize wrapper OpenCV SIFT wrapper | |
| 29 | - * \br_link http://docs.opencv.org/modules/nonfree/doc/feature_detection.html | |
| 30 | - * \author Josh Klontz \cite jklontz | |
| 31 | - */ | |
| 32 | -class SIFTDescriptorTransform : public UntrainableTransform | |
| 33 | -{ | |
| 34 | - Q_OBJECT | |
| 35 | - Q_PROPERTY(int size READ get_size WRITE set_size RESET reset_size STORED false) | |
| 36 | - Q_PROPERTY(QList<int> sizes READ get_sizes WRITE set_sizes RESET reset_sizes STORED false) | |
| 37 | - Q_PROPERTY(int nFeatures READ get_nFeatures WRITE set_nFeatures RESET reset_nFeatures STORED false) | |
| 38 | - Q_PROPERTY(int nOctaveLayers READ get_nOctaveLayers WRITE set_nOctaveLayers RESET reset_nOctaveLayers STORED false) | |
| 39 | - Q_PROPERTY(double contrastThreshold READ get_contrastThreshold WRITE set_contrastThreshold RESET reset_contrastThreshold STORED false) | |
| 40 | - Q_PROPERTY(double edgeThreshold READ get_edgeThreshold WRITE set_edgeThreshold RESET reset_edgeThreshold STORED false) | |
| 41 | - Q_PROPERTY(double sigma READ get_sigma WRITE set_sigma RESET reset_sigma STORED false) | |
| 42 | - BR_PROPERTY(int, size, 1) | |
| 43 | - BR_PROPERTY(QList<int>, sizes, QList<int>()) | |
| 44 | - BR_PROPERTY(int, nFeatures, 0) | |
| 45 | - BR_PROPERTY(int, nOctaveLayers, 3) | |
| 46 | - BR_PROPERTY(double, contrastThreshold, 0.04) | |
| 47 | - BR_PROPERTY(double, edgeThreshold, 10) | |
| 48 | - BR_PROPERTY(double, sigma, 1.6) | |
| 49 | - | |
| 50 | - Ptr<SIFT> sift; | |
| 51 | - | |
| 52 | - void init() | |
| 53 | - { | |
| 54 | - if (sizes.empty()) | |
| 55 | - sizes.append(size); | |
| 56 | - sift = SIFT::create(nFeatures, nOctaveLayers, contrastThreshold, edgeThreshold, sigma); | |
| 57 | - } | |
| 58 | - | |
| 59 | - void project(const Template &src, Template &dst) const | |
| 60 | - { | |
| 61 | - std::vector<KeyPoint> keyPoints; | |
| 62 | - foreach (const QPointF &val, src.file.points()) | |
| 63 | - foreach (const int r, sizes) | |
| 64 | - keyPoints.push_back(KeyPoint(val.x(), val.y(), r)); | |
| 65 | - | |
| 66 | - Mat m; | |
| 67 | - sift->detectAndCompute(src.m(), Mat(), keyPoints, m, true); | |
| 68 | - m.setTo(0, m<0); // SIFT returns large negative values when it goes off the edge of the image. | |
| 69 | - dst += m; | |
| 70 | - } | |
| 71 | -}; | |
| 72 | - | |
| 73 | -BR_REGISTER(Transform, SIFTDescriptorTransform) | |
| 74 | - | |
| 75 | -} // namespace br | |
| 76 | - | |
| 77 | -#include "imgproc/sift.moc" |
openbr/plugins/video/opticalflow.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 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 | -#include <opencv2/video/tracking.hpp> | |
| 18 | -#include <opencv2/video/background_segm.hpp> | |
| 19 | - | |
| 20 | -#include <openbr/plugins/openbr_internal.h> | |
| 21 | -#include <openbr/core/opencvutils.h> | |
| 22 | - | |
| 23 | -using namespace cv; | |
| 24 | - | |
| 25 | -namespace br | |
| 26 | -{ | |
| 27 | - | |
| 28 | -/*! | |
| 29 | - * \ingroup transforms | |
| 30 | - * \brief Gets a one-channel dense optical flow from two images | |
| 31 | - * \author Austin Blanton \cite imaus10 | |
| 32 | - */ | |
| 33 | -class OpticalFlowTransform : public UntrainableMetaTransform | |
| 34 | -{ | |
| 35 | - Q_OBJECT | |
| 36 | - Q_PROPERTY(double pyr_scale READ get_pyr_scale WRITE set_pyr_scale RESET reset_pyr_scale STORED false) | |
| 37 | - Q_PROPERTY(int levels READ get_levels WRITE set_levels RESET reset_levels STORED false) | |
| 38 | - Q_PROPERTY(int winsize READ get_winsize WRITE set_winsize RESET reset_winsize STORED false) | |
| 39 | - Q_PROPERTY(int iterations READ get_iterations WRITE set_iterations RESET reset_iterations STORED false) | |
| 40 | - Q_PROPERTY(int poly_n READ get_poly_n WRITE set_poly_n RESET reset_poly_n STORED false) | |
| 41 | - Q_PROPERTY(double poly_sigma READ get_poly_sigma WRITE set_poly_sigma RESET reset_poly_sigma STORED false) | |
| 42 | - Q_PROPERTY(int flags READ get_flags WRITE set_flags RESET reset_flags STORED false) | |
| 43 | - Q_PROPERTY(bool useMagnitude READ get_useMagnitude WRITE set_useMagnitude RESET reset_useMagnitude STORED false) | |
| 44 | - // these defaults are optimized for KTH | |
| 45 | - BR_PROPERTY(double, pyr_scale, 0.1) | |
| 46 | - BR_PROPERTY(int, levels, 1) | |
| 47 | - BR_PROPERTY(int, winsize, 5) | |
| 48 | - BR_PROPERTY(int, iterations, 10) | |
| 49 | - BR_PROPERTY(int, poly_n, 7) | |
| 50 | - BR_PROPERTY(double, poly_sigma, 1.1) | |
| 51 | - BR_PROPERTY(int, flags, 0) | |
| 52 | - BR_PROPERTY(bool, useMagnitude, true) | |
| 53 | - | |
| 54 | - void project(const Template &src, Template &dst) const | |
| 55 | - { | |
| 56 | - // get the two images put there by AggregateFrames | |
| 57 | - if (src.size() != 2) qFatal("Optical Flow requires two images."); | |
| 58 | - Mat prevImg = src[0], nextImg = src[1], flow; | |
| 59 | - if (src[0].channels() != 1) OpenCVUtils::cvtGray(src[0], prevImg); | |
| 60 | - if (src[1].channels() != 1) OpenCVUtils::cvtGray(src[1], nextImg); | |
| 61 | - calcOpticalFlowFarneback(prevImg, nextImg, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags); | |
| 62 | - | |
| 63 | - if (useMagnitude) { | |
| 64 | - // the result is two channels | |
| 65 | - Mat flowOneCh; | |
| 66 | - std::vector<Mat> channels(2); | |
| 67 | - split(flow, channels); | |
| 68 | - magnitude(channels[0], channels[1], flowOneCh); | |
| 69 | - dst += flowOneCh; | |
| 70 | - } else { | |
| 71 | - dst += flow; | |
| 72 | - } | |
| 73 | - dst.file = src.file; | |
| 74 | - } | |
| 75 | -}; | |
| 76 | - | |
| 77 | -BR_REGISTER(Transform, OpticalFlowTransform) | |
| 78 | - | |
| 79 | -} // namespace br | |
| 80 | - | |
| 81 | -#include "video/opticalflow.moc" |