image.h
Go to the documentation of this file.
/*
* Copyright (C) 2018 dimercur
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _IMAGE_H_
#define _IMAGE_H_
#ifndef __STUB__
#ifndef __FOR_PC__
#include <raspicam/raspicam_cv.h>
#else
#include <opencv2/highgui/highgui.hpp>
#endif /* __FOR_PC__ */
#else
#include <opencv2/highgui/highgui.hpp>
#endif
#include "opencv2/imgproc/imgproc.hpp"
#include <unistd.h>
#include <math.h>
#define WIDTH 480 //1280 1024 640 480
#define HEIGHT 360 // 960 768 480 360
using namespace std;
using namespace cv;
#ifndef __STUB__
#ifndef __FOR_PC__
using namespace raspicam;
#endif /* __FOR_PC__ */
#endif
typedef Mat Image;
#ifndef __STUB__
#ifndef __FOR_PC__
typedef RaspiCam_Cv Camera;
#else
typedef int Camera;
#endif /* __FOR_PC__ */
#else
typedef int Camera;
#endif
typedef Rect Arene;
typedef vector<unsigned char> Jpg;
struct Position {
Point center;
Point direction;
float angle;
};
int open_camera(Camera *camera);
void close_camera(Camera *camera);
void get_image(Camera *camera, Image * monImage, const char *fichier = NULL);
int detect_arena(Image *monImage, Arene *rectangle);
void draw_arena(Image *imgInput, Image *imgOutput, Arene *monArene);
int detect_position(Image *imgInput, Position *posTriangle, Arene * monArene = NULL);
void draw_position(Image *imgInput, Image *imgOutput, Position *positionRobot);
void compress_image(Image *imgInput, Jpg *imageCompress);
#endif // _IMAGE_H_
Position::center
Point center
Definition: image.h:70
Position::angle
float angle
Definition: image.h:72
draw_position
void draw_position(Image *imgInput, Image *imgOutput, Position *positionRobot)
Dessine sur une image en entrée la position d&#39;un robot et sa direction.
Arene
Rect Arene
Definition: image.h:66
open_camera
int open_camera(Camera *camera)
Ouvre une camera.
close_camera
void close_camera(Camera *camera)
Ferme la camera passé en paramètre.
std
Image
Mat Image
Definition: image.h:55
detect_position
int detect_position(Image *imgInput, Position *posTriangle, Arene *monArene=NULL)
Détecte la position d&#39;un robot.
cv
get_image
void get_image(Camera *camera, Image *monImage, const char *fichier=NULL)
Capture une image avec la camera passée en entrée. En cas de test sans camera, la fonction charge une...
Position
Definition: image.h:69
Jpg
vector< unsigned char > Jpg
Definition: image.h:67
draw_arena
void draw_arena(Image *imgInput, Image *imgOutput, Arene *monArene)
Dessine le plus petit rectangle contenant l&#39;arène.
Camera
RaspiCam_Cv Camera
Definition: image.h:58
compress_image
void compress_image(Image *imgInput, Jpg *imageCompress)
Détecte la position d&#39;un robot.
raspicam
detect_arena
int detect_arena(Image *monImage, Arene *rectangle)
Détecte une arène dans une image fournis en paramètre.
Position::direction
Point direction
Definition: image.h:71