117void FakeFrameGrabber::printTime(
unsigned char*
pixbuf,
size_t pixbuf_w,
size_t pixbuf_h,
size_t x,
size_t y,
char* s,
size_t size)
119 for (
size_t i = 0; i < size; i++)
121 const char*
num_p =
nullptr;
149 unsigned char *pixel =
pixbuf;
150 size_t offset =
c *
sizeof(yarp::sig::PixelRgb) + r * (
pixbuf_w *
sizeof(yarp::sig::PixelRgb));
151 pixel = pixel + offset;
167 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
171 t -= (((t*1000) -
static_cast<int64_t>(t*1000)) / 1000);
179 if (m_ct>=
image.height()) {
182 if (m_by>=
image.height()) {
183 m_by =
image.height()-1;
185 if (m_bx>=
image.width()) {
186 m_bx =
image.width()-1;
193 image.copy(background);
200 std::snprintf(
txtbuf, 50,
"%.3f", time);
208 else if (
m_mode ==
"[ball]")
212 image.copy(background);
230 if (
dx>0) { m_bx++; }
231 if (
dx<0) { m_bx--; }
232 if (
dy>0) { m_by++; }
233 if (
dy<0) { m_by--; }
237 else if (
m_mode ==
"[grid]")
243 for (
size_t x=0; x<
ww; x++) {
244 for (
size_t y=0; y<
hh; y++) {
247 bool act = (y==m_ct);
248 auto r =
static_cast<unsigned char>(0.5 + 255 *
xx);
249 auto g =
static_cast<unsigned char>(0.5 + 255 *
yy);
250 auto b =
static_cast<unsigned char>(
act * 255);
251 image.pixel(x, y) = PixelRgb{r, g, b};
257 else if (
m_mode ==
"[size]")
259 static int count = 0;
264 image.resize(100,100);
266 else if (count == 200)
269 image.resize(200, 100);
271 else if (count == 300)
274 image.resize(300, 50);
281 for (
size_t x = 0; x<
ww; x++) {
282 for (
size_t y = 0; y<
hh; y++) {
285 bool act = (y == m_ct);
286 auto r =
static_cast<unsigned char>(0.5 + 255 *
xx);
287 auto g =
static_cast<unsigned char>(0.5 + 255 *
yy);
288 auto b =
static_cast<unsigned char>(
act * 255);
289 image.pixel(x, y) = PixelRgb{r, g, b};
294 else if (
m_mode ==
"[line]")
298 image.copy(background);
302 for (
size_t i=0; i<
image.width(); i++) {
303 image.pixel(i,m_ct).r = 255;
307 else if (
m_mode ==
"[rand]")
310 static unsigned char r = 128;
311 static unsigned char g = 128;
312 static unsigned char b = 128;
318 for (
size_t x=0; x<
ww; x++) {
319 for (
size_t y=0; y<
hh; y++) {
320 r += udist(randengine);
321 g += udist(randengine);
322 b += udist(randengine);
323 image.pixel(x,y) = PixelRgb{r,g,b};
329 else if (
m_mode ==
"[none]")
333 image.copy(background);
346 static const double nsr = 1.0 -
m_snr;
347 for (
size_t x = 0; x <
image.width(); ++x) {
348 for (
size_t y = 0; y <
image.height(); ++y) {
349 auto rand = ucdist(randengine);
350 image.pixel(x,y) = PixelRgb {
362 std::snprintf(
ttxt, 50,
"%021.10f", timestamp);
401bool FakeFrameGrabber::makeSimpleBayer(
405 bayer.resize(img.width(), img.height());
407 const size_t w = img.width();
408 const size_t h = img.height();
411 for (i = 0; i < h; i++) {
412 auto*
row = (PixelRgb *)img.getRow(i);
415 for (j = 0; j < w; j++) {
A mini-server for performing network communication in the background.
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
An interface to the operating system, including Port based communication.
void addCircle(ImageOf< T > &dest, const T &pix, int i, int j, int r)