Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ ENDIF (WIN32)
IF (COMMAND CMAKE_POLICY)
CMAKE_POLICY (SET CMP0003 NEW)
CMAKE_POLICY (SET CMP0004 NEW)
#CMAKE_POLICY (SET CMP0148 NEW)
ENDIF (COMMAND CMAKE_POLICY)

# Fix an issue with a forbidden operand when using C++17
set (CMAKE_CXX_STANDARD 11)

# Set the project name (helps Visual Studio, mainly)
PROJECT (Player)
Expand Down Expand Up @@ -47,6 +50,9 @@ OPTION (PLAYER_BUILD_TESTS "Enables compilation of the test suites" ON)

# Look for various needed things
INCLUDE (${PLAYER_CMAKE_DIR}/internal/SearchForStuff.cmake)
# Find and use OpenCV directories
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# Give the user some compile options
INCLUDE (${PLAYER_CMAKE_DIR}/internal/GeneralCompileOptions.cmake)
# Write the config.h file
Expand Down
10 changes: 5 additions & 5 deletions server/drivers/blobfinder/shapetracker/shapetracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ the Player 2.0 API.
#include <libplayercore/playercore.h>
#include <base/imagebase.h>

#include <cv.h>
//#include <highgui.h>
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui_c.h"

#define winName "ShapeTracker"

Expand Down Expand Up @@ -100,7 +100,7 @@ class ShapeTracker : public ImageBase
private: CvHistogram *hist;
private: int histSize;
private: unsigned char lut[256];
private: CvMat *lutMat;
private: CvMat *lutMat;

private: double threshold;
private: int vertices;
Expand All @@ -109,8 +109,8 @@ class ShapeTracker : public ImageBase
private: unsigned int shapeCount;

// Kalmna filters used to track a shape
private: CvKalman *kalmanX;
private: CvKalman *kalmanY;
//private: CvKalman *kalmanX;
//private: CvKalman *kalmanY;
private: int kalmanFirst;

private: CvPoint orientPoint;
Expand Down
39 changes: 30 additions & 9 deletions server/drivers/blobfinder/simpleshape/simpleshape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,25 @@ driver
#include <string.h>
#include "../../base/imagebase.h"

#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgcodecs/legacy/constants_c.h"

/* CvScalar re-definition */
inline CvScalar to_CvScalar(cv::Scalar s)
{
CvScalar ret;

ret.val[0] = s.val[0]; // blue
ret.val[1] = s.val[1]; // green
ret.val[2] = s.val[2]; // red
ret.val[3] = s.val[3]; // alpha

return ret;
}

// Invariant feature set for a contour
class FeatureSet
Expand Down Expand Up @@ -292,13 +309,17 @@ void SimpleShape::MainQuit()
int SimpleShape::LoadModel()
{
IplImage *img, *work;
cv::Mat img2 = cv::cvarrToMat(img);
CvSize size;
CvSeq *contour, *maxContour;
double area, maxArea;

// Load the image
img = cvLoadImage(this->modelFilename, 0);
if (img == NULL)
//img = cvLoadImage( this->modelFilename, 0);
img2 = cv::imread( this->modelFilename, cv::IMREAD_GRAYSCALE );

//if (img == NULL)
if ( img2.empty () )
{
PLAYER_ERROR("failed to load model file");
return -1;
Expand Down Expand Up @@ -475,8 +496,8 @@ void SimpleShape::FindShapes()

// Draw eligable contour on the output image; useful for debugging
if (this->debugcam)
cvDrawContours(this->outSubImages + 2, contour, CV_RGB(255, 255, 255),
CV_RGB(255, 255, 255), 0, 1, 8);
cvDrawContours(this->outSubImages + 2, contour, to_CvScalar(CV_RGB(255, 255, 255)),
to_CvScalar(CV_RGB(255, 255, 255)), 0, 1, 8);

// Compute the contour features
this->ExtractFeatureSet((CvContour*) contour, &featureSet);
Expand All @@ -489,10 +510,10 @@ void SimpleShape::FindShapes()
// Draw contour on the main image; useful for debugging
if (this->debugcam)
{
cvDrawContours(this->outSubImages + 3, contour, CV_RGB(128, 128, 128),
CV_RGB(128, 128, 128), 0, 1, 8);
cvDrawContours(this->outSubImages + 3, contour, to_CvScalar(CV_RGB(128, 128, 128)),
to_CvScalar(CV_RGB(128, 128, 128)), 0, 1, 8);
cvRectangle(this->outSubImages + 3, cvPoint(rect.x, rect.y),
cvPoint(rect.x + rect.width, rect.y + rect.height), CV_RGB(255, 255, 255), 1);
cvPoint(rect.x + rect.width, rect.y + rect.height), to_CvScalar(CV_RGB(255, 255, 255)), 1);
}

// Check for overrun
Expand Down
5 changes: 3 additions & 2 deletions server/drivers/blobfinder/upcbarcode/upcbarcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ driver

#include "../../base/imagebase.h"

#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"

// Info on potential blobs.
struct blob_t
Expand Down
10 changes: 6 additions & 4 deletions server/drivers/camera/cvcam/cvcam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
///////////////////////////////////////////////////////////////////////////

/** @ingroup drivers */
/** @{ */
/** @defgroup driver_cvcam cvcam
/** @{ *//** @defgroup driver_cvcam cvcam
* @brief OpenCV camera capture

The cvcam driver captures images from cameras through OpenCV infrastructure.
Expand Down Expand Up @@ -87,8 +86,11 @@ driver
#include <pthread.h>
#include <libplayercore/playercore.h>

#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/videoio/videoio.hpp"
#include "opencv2/videoio/videoio_c.h"

//---------------------------------

Expand Down
21 changes: 13 additions & 8 deletions server/drivers/camera/imageseq/imageseq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ driver

#include <libplayercore/playercore.h>

#include <cv.h>
#include <highgui.h>

#include <opencv2/opencv.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgcodecs/legacy/constants_c.h"

class ImageSeq : public ThreadedDriver
{
Expand Down Expand Up @@ -203,10 +204,14 @@ int ImageSeq::LoadImage(const char *filename)
char *src;
uint8_t *dst;
IplImage *image;
cv::Mat image2 = cv::cvarrToMat(image);

// Load image; currently forces the image to mono
image = cvLoadImage(filename, -1);
if(image == NULL)
//image = cvLoadImage(filename, -1);
image2 = cv::imread( filename, cv::IMREAD_UNCHANGED );

//if(image == NULL)
if( image2.empty() )
{
PLAYER_ERROR1("Could not load image file: %s", filename);
return -1;
Expand All @@ -224,7 +229,7 @@ int ImageSeq::LoadImage(const char *filename)
switch (image->depth)
{
case IPL_DEPTH_8U:
case IPL_DEPTH_8S:
case int IPL_DEPTH_8S:
if (image->nChannels == 1)
{
this->data.bpp = 8;
Expand All @@ -236,14 +241,14 @@ int ImageSeq::LoadImage(const char *filename)
this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
}
break;
case IPL_DEPTH_16S:
case int IPL_DEPTH_16S:
if (image->nChannels == 1)
{
this->data.bpp = 16;
this->data.format = PLAYER_CAMERA_FORMAT_MONO16;
}
break;
case IPL_DEPTH_32S:
case int IPL_DEPTH_32S:
case IPL_DEPTH_32F:
case IPL_DEPTH_64F:
default:
Expand Down
5 changes: 3 additions & 2 deletions server/drivers/camera/videocanny/videocanny.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ driver
#include <libplayercore/playercore.h>
#include <libplayerjpeg/playerjpeg.h>

#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"

typedef enum { canny = 0, sobel, laplace } func_t;

Expand Down