This part of the robot structure provides .

Main screen functions

   // screen resolution (from _CONFIG_.u file)
robot.screen.resolutionX;
robot.screen.resolutionY;
   // get displayed image
robot.screen.image;
 
   // create black screen @ given resolution
robot.screen.CreateBlack();
   // display image (fast raw display, no scaling, no drawing option)
   // image must be binary type, eg. from UCamera.image slot.
   // robot.screen.DisplayImageFast(robot.video.camera.image);
robot.screen.DisplayImageFast(image);
   // display image from binary source or  file path
   // x,y - position of the center of the image on the screen [0...1], calculated from preset resolution
   // scale - size of the image - a fraction of the screen
   // eg. 
   // robot.screen.DisplayImage(robot.video.camera.image, 0.5, 0.5, 1);
   // or
   // robot.screen.DisplayImage("image.jpg", 0.5, 0.5, 1);
robot.screen.DisplayImage(image, x, y, scale);
   // animate image (appear effect)
   // x,y - position of the center of the image on the screen [0...1], calculated from preset resolution
   // scale - final size to be reached by the animated object, as a fraction of the screen
   // time - total animation time in seconds, if time is negative, image will disappear at given position and starting scale
   // eg.
   // robot.screen.DisplayImage(robot.video.camera.image, 0.5, 0.5, 1, 1);
   // or
   // robot.screen.DisplayImage("image.jpg", 0.5, 0.5, 1 , 1);
robot.screen.ScaleImage(image, x, y, scale, time);
 
 

Image tool functions

This part is a full copy of UImageTool module, after every tool operation use robot.screen.tool.Update function to display changes.

   // display changes made by tool part of the structure
robot.screen.tool.Update;
 
   // load image to internal buffer from file 
   // to display use putImage(..) function 
robot.screen.tool.loadImage2Buffer("filename");        
   // set image to internal buffer from image source
   // to display use putImage(..) function 
robot.screen.tool.setImage2Buffer(image);      
   // put image and overlay on the existing image,
   // "filename" -  filename or left empty ("") to get 
   // image from buffer (use loadImage2Buffer(..) function first),
   // x, y - location,
   // scale - resize image, 1 - no scale (float and must be >0),
   // opacity 0..1.
robot.screen.tool.putImage("filename", x, y, scale, opacity);  
   // create image filled given color  
robot.screen.tool.createImage(width, height, red, green, blue);
 
   // save image to file
robot.screen.tool.saveImage("filename");
 
   // get only one channel of image
   // ex. in RGB:
   // 0 - red,
   // 1 - green,
   // 2 - blue.
robot.screen.tool.getChannel(channel);  
   // convert to color space
   // type:
   // CV_BGR2RGB     = 4,
   // CV_RGB2BGR     = CV_BGR2RGB,
 
   // CV_BGR2GRAY    = 6,
   // CV_RGB2GRAY    = 7,
   // CV_GRAY2BGR    = 8,
   // CV_GRAY2RGB    = CV_GRAY2BGR,
 
   // CV_BGR2HSV     = 40,
   // CV_RGB2HSV     = 41,
   // CV_HSV2BGR     = 54,
   // CV_HSV2RGB     = 55, 
robot.screen.tool.imgConvert(type);        
   // resize image with given scale float and >0)
robot.screen.tool.imgResize(scale);    
   // rotate image around the point, angle in degree
robot.screen.tool.imgRotate(x,y,angle);  
   // crop image    
robot.screen.tool.imgROI(x,y,width,hight);  
   // rotate or flip image
   // operation:
   // rotate 90          = 0,
   // rotate 180         = 1,
   // rotate 270        = 2,
   // flip horizontal   = 3,
   // flip vertical     = 4,
robot.screen.tool.imgRotateFlip(operation);  
   // get pixel value
robot.screen.tool.getPixelValue(x,y);         
 
   // Morphological operation
   // operation:
   // CV_MOP_ERODE        = 0,
   // CV_MOP_DILATE       = 1,
   // CV_MOP_OPEN         = 2,
   // CV_MOP_CLOSE        = 3,
   // CV_MOP_GRADIENT     = 4,
   // CV_MOP_TOPHAT       = 5,
   // CV_MOP_BLACKHAT     = 6,
   // shape:
   // MORPH_RECT    = 0, 
   // MORPH_CROSS    = 1,
   // MORPH_ELLIPSE    = 2  
robot.screen.tool.imgMorphology(operation, shape, size);
 
   // blur functions
robot.screen.tool.imgBlur(size);      
robot.screen.tool.imgMedianBlur(size);  
 
   // threshold function
   // thresholdType:
   // THRESH_BINARY      =0,  value = value > threshold ? 255 : 0      
   // THRESH_BINARY_INV  =1,  value = value > threshold ? 0 : 255      
   // THRESH_TRUNC       =2,  value = value > threshold ? threshold : value  
   // THRESH_TOZERO      =3,  value = value > threshold ? value : 0           
   // THRESH_TOZERO_INV  =4,  value = value > threshold ? 0 : value  
robot.screen.tool.imgThreshold(thresh, thresholdType);  
 
   // drawing functions
   // put line on image
robot.screen.tool.putLine(x1, y1, x2, y2, red, green, blue,  thicknes);  
   // put rectangle on image
robot.screen.tool.putRectangle(x1, y1, x2, y2, red, green, blue, thickness);  
   // put circle on image
robot.screen.tool.putCircle(x, y, radius, red, green, blue, thickness);    
   // put text on image
robot.screen.tool.putString("text", x, y, font , fontscale ,red, green, blue, thickness); 
 
   // other functions
   // last processing time 
robot.screen.tool.time;    
   // image width
robot.screen.tool.width;
   // image height
robot.screen.tool.height;  
   // image in buffer width
robot.screen.tool.bufferWidth;  
   // image in buffer height
robot.screen.tool.bufferHeight;  
 
   // Interpolation method used with scaling
robot.screen.tool.interpolationMethod; 
   // INTER_NEAREST = 0 - a nearest-neighbor interpolation,
   // INTER_LINEAR = 1 - a bilinear interpolation (used by default),
   // INTER_AREA = 2 - resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method,
   // INTER_CUBIC = 3 - a bicubic interpolation over 4x4 pixel neighborhood,
   // INTER_LANCZOS4 - 4 - a Lanczos interpolation over 8x8 pixel neighborhood,
 

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 1.0, 04.04.2018

FLASH Documentation