|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARP_SIG_IMAGEDRAW_H
11 #define YARP_SIG_IMAGEDRAW_H
30 int x,
int y,
int dx,
int dy) {
31 const double vx = double(dx - x);
32 const double vy = double(dy - y);
34 double vbigger = fabs((fabs(vy)>fabs(vx))?vy:vx);
35 const int steps = int(2*vbigger);
36 const double r = 1.0 / steps;
37 for (
int i = 0; i <= steps; i++) {
38 dest.
safePixel(
int(x+vx*i*r),
int(y+vy*i*r)) = pix;
44 int i,
int j,
int r) {
45 float d, r2 = (float)(r*r);
46 for (
int ii=i-r; ii<=i+r; ii++) {
47 for (
int jj=j-r; jj<=j+r; jj++) {
48 d = float((ii-i)*(ii-i)+(jj-j)*(jj-j));
58 int i,
int j,
int r) {
59 for (
int ii=i-r; ii<=i+r; ii++) {
60 for (
int jj=j-r; jj<=j+r; jj++) {
70 int i,
int j,
int r) {
71 float d, r2 = float(r*r), r2l = float((r-1.1)*(r-1.1));
72 for (
int ii=i-r; ii<=i+r; ii++) {
73 for (
int jj=j-r; jj<=j+r; jj++) {
74 d = float((ii-i)*(ii-i)+(jj-j)*(jj-j));
75 if (d<=r2 && d>=r2l) {
84 int i,
int j,
int h2,
int w2) {
86 for (
float th=0; th<2.0*3.14159; th+=0.01) {
96 int i,
int j,
int w,
int h) {
97 for (
int ii=i-w; ii<=i+w; ii++) {
103 for (
int jj=j-h; jj<=j+h; jj++) {
116 int i,
int j,
int w,
int h) {
117 for (
int ii=i-w; ii<=i+w; ii++) {
118 for (
int jj=j-h; jj<=j+h; jj++) {
126 const T& thetalo,
const T& thetahi,
127 const T& pix0,
const T& pix1) {
128 int h = src.height();
130 for (
int i=0; i<h; i++) {
131 for (
int j=0; j<w; j++) {
132 if (src(i,j)>=thetalo && src(i,j)<=thetahi) {
144 int h = src.height();
146 for (
int i=0; i<h; i++) {
147 for (
int j=0; j<w; j++) {
154 #define IMGFOR(img,i,j) for (size_t i=0; i<(img).width(); i++) for (size_t j=0; j<(img).height(); j++)
161 #endif // YARP_SIG_IMAGEDRAW_H
int applyThreshold(ImageOf< T > &src, ImageOf< T > &dest, const T &thetalo, const T &thetahi, const T &pix0, const T &pix1)
void addRectangle(ImageOf< T > &dest, const T &pix, int i, int j, int w, int h)
warning : i, j is x, y center of rectangle
void addOvalOutline(ImageOf< T > &dest, const T &pix, int i, int j, int h2, int w2)
void setImagePixels(ImageOf< T > &src, const T &pix)
T & safePixel(size_t x, size_t y)
void addSegment(ImageOf< T > &dest, const T &pix, int x, int y, int dx, int dy)
void addCrossHair(ImageOf< T > &dest, const T &pix, int i, int j, int r)
void addCircleOutline(ImageOf< T > &dest, const T &pix, int i, int j, int r)
void addRectangleOutline(ImageOf< T > &dest, const T &pix, int i, int j, int w, int h)
The main, catch-all namespace for YARP.
void addCircle(ImageOf< T > &dest, const T &pix, int i, int j, int r)