Legoktm has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/372968 )

Change subject: Remove obsolete fback and linehash code
......................................................................


Remove obsolete fback and linehash code

According to Tim these were prototypes and not used anymore.

Change-Id: I05ca6960ac4b5718be21e57fb338ce06f174c153
---
M Makefile
D fback.cpp
D linehash.cpp
3 files changed, 0 insertions(+), 185 deletions(-)

Approvals:
  Legoktm: Verified; Looks good to me, approved



diff --git a/Makefile b/Makefile
index b6f34c7..46ba8e9 100644
--- a/Makefile
+++ b/Makefile
@@ -15,20 +15,5 @@
                -lboost_program_options \
                -o uprightdiff
 
-linehash:
-       g++ $(CFLAGS) linehash.cpp \
-               -lmhash \
-               -lopencv_highgui \
-               -lopencv_core \
-               -o linehash
-
-fback:
-       g++ $(CFLAGS) fback.cpp \
-               -lopencv_highgui \
-               -lopencv_core \
-               -lopencv_video \
-               -lopencv_imgproc \
-               -o fback
-
 clean:
        rm -f uprightdiff
diff --git a/fback.cpp b/fback.cpp
deleted file mode 100644
index eaf6829..0000000
--- a/fback.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#include <opencv2/video/tracking.hpp>
-#include <opencv2/imgproc/imgproc.hpp>
-#include <opencv2/highgui/highgui.hpp>
-
-#include <iostream>
-
-static void drawOptFlowMap(const cv::Mat& flow, cv::Mat& cflowmap, int step,
-                    int mapScale, const cv::Scalar& color);
-static void drawColorCodedMap(const cv::Mat& flow, cv::Mat& map);
-
-static cv::Mat prepareImage(cv::Mat input, cv::Size size);
-
-
-int main(int argc, char** argv)
-{
-       const int minLevelSize = 32;
-       
-       if (argc < 4) {
-               std::cout << "Usage: fback <input1> <input2> <output>\n";
-               return 1;
-       }
-
-       cv::Mat leftInput = cv::imread(argv[1]);
-       cv::Mat rightInput = cv::imread(argv[2]);
-
-       cv::Size size(
-                       std::max(leftInput.cols, rightInput.cols),
-                       std::max(leftInput.rows, rightInput.rows));
-
-       const int numLevels = 1;
-
-       std::cout << "Creating " << size.width << "x" << size.height << " flow 
field\n";
-       
-       cv::Mat left = prepareImage(leftInput, size);
-       cv::Mat right = prepareImage(rightInput, size);
-       cv::Mat flow;
-
-       if (false) {
-               cv::calcOpticalFlowFarneback(left, right, flow, 0.5, numLevels, 
15, 3, 5, 1.2, 0);
-       } else {
-               cv::calcOpticalFlowSF(left, right, flow, numLevels, 4, 2);
-       }
-       
-       cv::Mat visual;
-       if (false) {
-               const int mapScale = 2;
-               cv::Mat leftBlended(size, CV_8UC3);
-               leftBlended = cv::Scalar(128, 128, 128);
-               leftBlended(cv::Rect(cv::Point(0, 0), leftInput.size())) += 
leftInput / 2;
-               cv::resize(leftBlended, visual, size * mapScale, 0, 0, 
cv::INTER_NEAREST);
-               std::cout << "Drawing map " << visual.cols << "x" << 
visual.rows << "\n";
-               drawOptFlowMap(flow, visual, 8, mapScale, cv::Scalar(0, 255, 
0));
-       } else {
-               drawColorCodedMap(flow, visual);
-       }
-
-       cv::imwrite(argv[3], visual);
-       return 0;
-}
-
-static void drawOptFlowMap(const cv::Mat& flow, cv::Mat& cflowmap, int step,
-               int mapScale, const cv::Scalar& color)
-{
-       for(int y = 0; y < flow.rows; y += step) {
-               for(int x = 0; x < flow.cols; x += step) {
-                       const cv::Point2f& fxy = flow.at<cv::Point2f>(y, x);
-                       cv::line(cflowmap, mapScale * cv::Point(x,y),
-                                       mapScale * cv::Point(cvRound(x+fxy.x), 
cvRound(y+fxy.y)),
-                                       color);
-                       cv::circle(cflowmap, mapScale * cv::Point(x,y), 2, 
color, -1);
-               }
-       }
-}
-
-static void drawColorCodedMap(const cv::Mat& flow, cv::Mat& map) {
-       // Calculate maximum
-       float maxVal = 0;
-       for (int y = 0; y < flow.rows; y++) {
-               for (int x = 0; x < flow.cols; x++) {
-                       const cv::Point2f& fxy = flow.at<cv::Point2f>(y, x);
-                       maxVal = std::max(maxVal ,std::sqrt(fxy.dot(fxy)));
-               }
-       }
-
-       cv::Mat_<cv::Vec3b> hsvMap(flow.size());
-       // Create map
-       for (int y = 0; y < flow.rows; y++) {
-               for (int x = 0; x < flow.cols; x++) {
-                       const cv::Point2f& fxy = flow.at<cv::Point2f>(y, x);
-                       cv::Vec3b & hsv = hsvMap(y, x);
-                       hsv[0] = cv::saturate_cast<unsigned 
char>(cv::fastAtan2(fxy.y, fxy.x) / 2);
-                       hsv[1] = 255;
-                       hsv[2] = cv::saturate_cast<unsigned 
char>(std::sqrt(fxy.dot(fxy)) / maxVal * 255.);
-               }
-       }
-       // Overlay legend
-       const int radius = maxVal;
-       const int centre = radius + 10;
-       for (int y = centre - radius; y <= centre + radius; y++) {
-               int dx = cvRound(std::sqrt(std::fabs(radius*radius - (y - 
centre) * (y - centre))));
-               for (int x = centre - dx; x <= centre + dx; x++) {
-                       cv::Vec3b & hsv = hsvMap(y, x);
-                       float angle = cv::fastAtan2(y - centre, x - centre);
-                       double r = std::sqrt((y - centre) * (y - centre) + (x - 
centre) * (x - centre));
-                       hsv[0] = cv::saturate_cast<unsigned char>(angle / 2);
-                       hsv[1] = 255;
-                       hsv[2] = cv::saturate_cast<unsigned char>(r * 255. / 
radius);
-               }
-       }
-
-       map.create(flow.size(), CV_8UC3);
-       cv::cvtColor(hsvMap, map, CV_HSV2BGR);
-}
-
-static cv::Mat prepareImage(cv::Mat input, cv::Size size) {
-       // Convert colour
-       cv::Mat gray;
-       cv::cvtColor(input, gray, CV_BGR2GRAY);
-       // Background fill
-       cv::Mat dest = cv::Mat::ones(size, CV_8UC1) * 255;
-
-       // Expand to desired dimensions by repeating the edge row/column
-       gray.copyTo(dest(cv::Rect(cv::Point(0, 0), gray.size())));
-       cv::Mat edge = gray.colRange(gray.cols - 1, gray.cols);
-       for (int x = gray.cols; x < size.width; x++) {
-               dest(cv::Rect(x, 0, 1, edge.rows)) = dest;
-       }
-
-       edge = gray.rowRange(gray.rows - 1, gray.rows);
-       for (int y = gray.rows; y < size.height; y++) {
-               dest(cv::Rect(0, y, edge.cols, 1)) = edge;
-       }
-
-       return dest;
-}
-
diff --git a/linehash.cpp b/linehash.cpp
deleted file mode 100644
index fc47ccf..0000000
--- a/linehash.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <opencv2/highgui/highgui.hpp>
-#include <iostream>
-#include <iomanip>
-#include <mhash.h>
-
-int main(int argc, char** argv) {
-       hashid algo = MHASH_MD5;
-       int hashSize = mhash_get_block_size(algo);
-       unsigned char hash[hashSize + 1];
-
-       if (argc < 1) {
-               return 1;
-       } else if (argc < 2) {
-               std::cerr << "Usage: " << argv[0] << " <input.png>\n";
-               return 1;
-       }
-       cv::Mat input = cv::imread(argv[1]);
-
-       for (int y = 0; y < input.rows; y++) {
-               MHASH hashState = mhash_init(algo);
-               const unsigned char* rowPtr = input.ptr(y);
-               mhash(hashState, 
-                               input.ptr(y),
-                               input.elemSize() * input.cols);
-               mhash_deinit(hashState, hash);
-
-               for (int i = 0; i < hashSize; i++) {
-                       std::cout << std::hex << std::setfill('0') << 
std::setw(2) <<
-                               int(hash[i]);
-               }
-               std::cout << std::endl;
-       }
-       return 0;
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/372968
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I05ca6960ac4b5718be21e57fb338ce06f174c153
Gerrit-PatchSet: 1
Gerrit-Project: integration/uprightdiff
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to