Skip to content

Commit

Permalink
Fixed coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Werkov committed Feb 27, 2015
1 parent 5508ce7 commit 0e20b54
Show file tree
Hide file tree
Showing 22 changed files with 6,482 additions and 155 deletions.
6,323 changes: 6,323 additions & 0 deletions contrib/cpplint.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions cstyle.sh
@@ -0,0 +1,6 @@
#!/bin/bash

find tools lib -name "*.h" -o -name "*.cc" |\
xargs contrib/cpplint.py \
--filter=-legal/copyright,-whitespace/comments,-whitespace/line_length,-readability/todo,-build/c++11 \
--root=lib/include
8 changes: 4 additions & 4 deletions lib/include/dove_eye/calibration_pattern.h
@@ -1,22 +1,22 @@
#ifndef DOVE_EYE_CALIBRATION_PATTERN_H_
#define DOVE_EYE_CALIBRATION_PATTERN_H_
#define DOVE_EYE_CALIBRATION_PATTERN_H_

#include <vector>

#include <opencv2/opencv.hpp>

#include <dove_eye/types.h>
#include "dove_eye/types.h"

namespace dove_eye {

class CalibrationPattern {
public:
virtual bool Match(const cv::Mat &image, Point2Vector &points) const = 0;
virtual bool Match(const cv::Mat &image, Point2Vector *points) const = 0;

virtual const Point3Vector & ObjectPoints() const = 0;
};

} // namespace dove_eye

#endif /* DOVE_EYE_CALIBRATION_PATTERN_H_ */
#endif // DOVE_EYE_CALIBRATION_PATTERN_H_

22 changes: 11 additions & 11 deletions lib/include/dove_eye/camera_calibration.h
@@ -1,15 +1,15 @@
#ifndef DOVE_EYE_CAMERA_CALIBRATION_H_
#define DOVE_EYE_CAMERA_CALIBRATION_H_
#define DOVE_EYE_CAMERA_CALIBRATION_H_

#include <cassert>
#include <vector>

#include <opencv2/opencv.hpp>

#include <dove_eye/calibration_pattern.h>
#include <dove_eye/camera_pair.h>
#include <dove_eye/frameset.h>
#include <dove_eye/types.h>
#include "dove_eye/calibration_pattern.h"
#include "dove_eye/camera_pair.h"
#include "dove_eye/frameset.h"
#include "dove_eye/types.h"

namespace dove_eye {

Expand All @@ -20,7 +20,7 @@ class CameraCalibration {
kCollecting,
kReady
};

struct CameraParameters {
cv::Mat camera_matrix;
cv::Mat distortion_coefficients;
Expand All @@ -29,10 +29,10 @@ class CameraCalibration {
struct PairParameters {
cv::Mat essential_matrix;
};

CameraCalibration(const CameraIndex camera_count,
const CalibrationPattern &pattern);

/** Search for pattern in frameset and use it for calibration.
*
* \return True when calibration finished successfully, false otherwise.
Expand Down Expand Up @@ -67,7 +67,7 @@ class CameraCalibration {

return camera_states_[cam];
}

MeasurementState pair_state(const CameraIndex cam1,
const CameraIndex cam2) const {
assert(cam1 < camera_count());
Expand All @@ -79,7 +79,7 @@ class CameraCalibration {
const CameraPair::PairArray &pairs() const {
return pairs_;
}

private:
const CameraIndex camera_count_;

Expand All @@ -100,5 +100,5 @@ class CameraCalibration {

} // namespace dove_eye

#endif /* DOVE_EYE_CAMERA_CALIBRATION_H_ */
#endif // DOVE_EYE_CAMERA_CALIBRATION_H_

12 changes: 5 additions & 7 deletions lib/include/dove_eye/camera_pair.h
@@ -1,10 +1,10 @@
#ifndef DOVE_EYE_CAMERA_PAIR_H_
#define DOVE_EYE_CAMERA_PAIR_H_
#define DOVE_EYE_CAMERA_PAIR_H_

#include <vector>

#include <dove_eye/calibration_pattern.h>
#include <dove_eye/frameset.h>
#include "dove_eye/calibration_pattern.h"
#include "dove_eye/frameset.h"

namespace dove_eye {

Expand All @@ -20,11 +20,9 @@ struct CameraPair {
static CameraIndex Index(const CameraIndex camera_count,
const CameraIndex cam1,
const CameraIndex cam2);
}

;
};

} // namespace dove_eye

#endif /* DOVE_EYE_CAMERA_PAIR_H_ */
#endif // DOVE_EYE_CAMERA_PAIR_H_

8 changes: 4 additions & 4 deletions lib/include/dove_eye/chessboard_pattern.h
@@ -1,19 +1,19 @@
#ifndef DOVE_EYE_CHESSBOARD_PATTERN_H_
#define DOVE_EYE_CHESSBOARD_PATTERN_H_
#define DOVE_EYE_CHESSBOARD_PATTERN_H_

#include <vector>

#include <opencv2/opencv.hpp>

#include <dove_eye/calibration_pattern.h>
#include "dove_eye/calibration_pattern.h"

namespace dove_eye {

class ChessboardPattern : public CalibrationPattern {
public:
ChessboardPattern(const int rows, const int columns, const double squareSize);

bool Match(const cv::Mat &image, Point2Vector &points) const override;
bool Match(const cv::Mat &image, Point2Vector *points) const override;

const Point3Vector & ObjectPoints() const override {
return object_points_;
Expand All @@ -26,5 +26,5 @@ class ChessboardPattern : public CalibrationPattern {

} // namespace dove_eye

#endif /* DOVE_EYE_CHESSBOARD_PATTERN_H_ */
#endif // DOVE_EYE_CHESSBOARD_PATTERN_H_

24 changes: 12 additions & 12 deletions lib/include/dove_eye/file_video_provider.h
@@ -1,34 +1,34 @@
#ifndef DOVE_EYE_FILE_VIDEO_PROVIDER_H_
#define DOVE_EYE_FILE_VIDEO_PROVIDER_H_
#define DOVE_EYE_FILE_VIDEO_PROVIDER_H_

#include <memory>
#include <string>

#include <opencv2/opencv.hpp>

#include <dove_eye/video_provider.h>
#include "dove_eye/video_provider.h"

namespace dove_eye {

class FileVideoProvider : public VideoProvider {
public:
FileVideoProvider(const std::string &filename);
explicit FileVideoProvider(const std::string &filename);

// Creates a new iterator, all copies share the state.
virtual FrameIterator begin() override;
FrameIterator begin() override;

virtual FrameIterator end() override;
FrameIterator end() override;

private:
class Iterator : public FrameIteratorImpl {
public:
Iterator(const FileVideoProvider &provider);

virtual Frame GetFrame() const override;
explicit Iterator(const FileVideoProvider &provider);

virtual void MoveNext() override;

virtual bool IsValid() override {
Frame GetFrame() const override;

void MoveNext() override;

bool IsValid() override {
return valid_;
}

Expand All @@ -47,5 +47,5 @@ class FileVideoProvider : public VideoProvider {

} // namespace dove_eye

#endif /* DOVE_EYE_FILE_VIDEO_PROVIDER_H_ */
#endif // DOVE_EYE_FILE_VIDEO_PROVIDER_H_

6 changes: 3 additions & 3 deletions lib/include/dove_eye/frame.h
@@ -1,5 +1,5 @@
#ifndef DOVE_EYE_FRAME_H_
#define DOVE_EYE_FRAME_H_
#define DOVE_EYE_FRAME_H_

#include <cstdint>

Expand All @@ -10,12 +10,12 @@ namespace dove_eye {
struct Frame {
typedef double Timestamp;
typedef double TimestampDiff;

Timestamp timestamp;
cv::Mat data;
};

} // namespace dove_eye

#endif /* DOVE_EYE_FRAME_H_ */
#endif // DOVE_EYE_FRAME_H_

13 changes: 7 additions & 6 deletions lib/include/dove_eye/frame_iterator.h
@@ -1,11 +1,11 @@
#ifndef DOVE_EYE_FRAME_ITERATOR_H_
#define DOVE_EYE_FRAME_ITERATOR_H_
#define DOVE_EYE_FRAME_ITERATOR_H_

#include <memory>

#include <opencv2/opencv.hpp>

#include <dove_eye/frame.h>
#include "dove_eye/frame.h"

namespace dove_eye {

Expand All @@ -16,7 +16,7 @@ class FrameIteratorImpl {
virtual Frame GetFrame() const = 0;

virtual void MoveNext() = 0;

virtual bool IsValid() = 0;
};

Expand All @@ -26,8 +26,8 @@ class FrameIterator {
* Takes ownership of the iterator and it's shared among copies of the
* iterator.
*/
FrameIterator(FrameIteratorImpl *iterator = nullptr) :
iterator_(iterator) {
explicit FrameIterator(FrameIteratorImpl *iterator = nullptr)
: iterator_(iterator) {
}

Frame operator*() const {
Expand All @@ -51,11 +51,12 @@ class FrameIterator {
inline bool operator!=(const FrameIterator &rhs) {
return !operator==(rhs);
}

private:
std::shared_ptr<FrameIteratorImpl> iterator_;
};

} // namespace dove_eye

#endif /* DOVE_EYE_FRAME_ITERATOR_H_ */
#endif // DOVE_EYE_FRAME_ITERATOR_H_

14 changes: 7 additions & 7 deletions lib/include/dove_eye/frameset.h
@@ -1,13 +1,13 @@
#ifndef DOVE_EYE_FRAMESET_H_
#define DOVE_EYE_FRAMESET_H_
#define DOVE_EYE_FRAMESET_H_

#include <cassert>
#include <cstdint>

#include <opencv2/opencv.hpp>

#include <dove_eye/frame.h>
#include <dove_eye/types.h>
#include "dove_eye/frame.h"
#include "dove_eye/types.h"

namespace dove_eye {

Expand All @@ -23,9 +23,9 @@ class Frameset {

Frameset() = delete;

Frameset(const CameraIndex size) :
size_(size),
validity_() {
explicit Frameset(const CameraIndex size)
: size_(size),
validity_() {
assert(size_ <= kMaxSize);
}

Expand Down Expand Up @@ -61,5 +61,5 @@ class Frameset {

} // namespace dove_eye

#endif /* DOVE_EYE_FRAMESET_H_ */
#endif // DOVE_EYE_FRAMESET_H_

0 comments on commit 0e20b54

Please sign in to comment.