Commit a8099593 authored by Jeff Niu's avatar Jeff Niu

Code cleanup

parent 0d48f92e
......@@ -55,7 +55,7 @@ endif()
if (UNIX)
set(THIRD_PARTY
third-party/qextserialenumerator_unix.cpp
third-party/qextserialport_unix.cpp code/video/shapedetect.cpp code/video/shapedetect.h)
third-party/qextserialport_unix.cpp)
endif()
file(GLOB_RECURSE SOURCE_FILES
......
......@@ -197,7 +197,8 @@ int CameraDisplay::getCamera() {
int getCameraIndex(const QCameraInfo &info) {
QString name = info.deviceName();
QChar index_char = name.at(name.length() - 1);
return index_char.unicode() - '0';
int index = index_char.unicode() - '0';
return index > 9 ? 0 : index;
}
void CameraDisplay::setVisible(bool visible) {
......@@ -206,9 +207,6 @@ void CameraDisplay::setVisible(bool visible) {
if (!QCameraInfo::availableCameras().empty()) {
camera_index = getCameraIndex(QCameraInfo::availableCameras()[0]);
}
if (camera_index >= 10) {
camera_index = 0;
}
QMetaObject::invokeMethod(&m_capture, "start", Q_ARG(int, camera_index));
} else {
pauseVideo();
......
......@@ -2,10 +2,7 @@
#include "squares.h"
#include "shapedetect.h"
#include <QDebug>
void VideoModifier::attachModifier(std::unique_ptr<VideoModifier> &ptr, int modifier) {
qDebug() << "Switching to effect: " << modifier;
switch(modifier) {
case SQUARES:
ptr.reset(new Squares);
......
This diff is collapsed.
//
// Created by Beini Fang on 2018-01-25.
//
/**
* Detects and tags, rectangles, triangles, and circles.
* Returns vertices of rectangles and triangles, and radius + center of circles
*
* @author Beini Fang
* @file shapedetect.h
*/
#ifndef MINOTAUR_CPP_SHAPEDETECT_H
#define MINOTAUR_CPP_SHAPEDETECT_H
......
......@@ -102,7 +102,6 @@ static void drawSquares(cv::Mat *image, const vector<vector<Point>> &squares) {
}
void Squares::modify(cv::Mat *img) {
qDebug() << "I love squares xd";
vector<vector<Point>> squares;
findSquares(img, squares);
drawSquares(img, squares);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment