33 PixelRgb w{255,255,255};
34 PixelRgb r{128,128,255};
42 for (
int i=0;
i<=m_w;
i+=m_w/10) {
47 std::uniform_real_distribution<double>
udist1(-m_w/4,m_w/4);
48 std::uniform_real_distribution<double>
udist2(-
int(m_h*0.2),
rr);
49 for (
int j=0;
j<40;
j++) {
55 m_x = (back.
width()-this->m_w)/2;
56 m_y = (back.
height()-this->m_h)/2;
59 std::normal_distribution<double>
ndist(0,255);
60 for (
int & rnd :
rnds) {
66 m_tx = back.
width()/2;
85 ch = (
unsigned char) x;
110 if (
fabs(dpos[0])>0.001||
fabs(dpos[0])>0.001) {
111 pos[0] = m_dx+dpos[0];
113 pos[1] = m_dy+dpos[1];
120 double dx = (
xx-m_dx)*5;
121 double dy = (
yy-m_dy)*5;
124 if (m_tdx>0 && m_tx>back.
width()*0.75) {
127 if (m_tdx<0 && m_tx<back.
width()*0.25) {
139 back.
safePixel(-1,-1) = PixelRgb{255,0,0};
151 PixelRgb&
pix = fore(
int(
x0-m_tx),
int(
y0-m_ty));
const yarp::os::LogComponent & FAKEBOT()
void scramble(unsigned char &ch, float f)
#define IMGFOR(img, i, j)
std::default_random_engine randengine
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void run() override
Main body of the new thread.
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
bool start()
Start the new thread running.
T & safePixel(size_t x, size_t y)
size_t width() const
Gets width of image in pixels.
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
bool isPixel(size_t x, size_t y) const
Check whether a coordinate lies within the image.
void zero()
Set all pixels to 0.
size_t height() const
Gets height of image in pixels.
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
An interface to the operating system, including Port based communication.
void addCircle(ImageOf< T > &dest, const T &pix, int i, int j, int r)
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)