[OpenR8 solution] Image (Create an image and capture the screen)
  1. Chater1: Image Introduction

 

The Image contains two files that demonstrate how to create an image and capture two solutions for the full screen.

 

The flow of how to create an image is shown in Fig. 1 (left), and the function flow is explained in chapter3 and chapter5 of this document.

 

The process of extracting the current picture is Fig. 1(right), and the function flow will be explained in chapter4 and chapter6 of this document.

 

Fig. 1. How to create an image and capture the current full screen.png

Fig. 1. How to create an image and capture the current full screen.

 

 

  1. Chapter2: Image folder introduction

 

Image is in the solution folder of OpenR8, as shown in Fig. 2, with two flow files, such as Fig. 3.

 

  1. Image.flow: Create an image solution.
  2. screenshot.flow:Capture a full screen solution.

 

Fig. 2. Image location.png

Fig. 2. Image location.

 

Fig. 3. Image folder.png

Fig. 3. Image folder.

 

 

  1. Chapter3: Open and run Image.flow

 

There is the “R8.exe” executable file under OpenR8 folder, as shown in Figure 4. Double-click to execute R8.exe.

 

Fig. 4. execute R8.png

Fig. 4. execute R8.exe.

 

Please click “File” => “Open” => “enter the solution folder under OpenR8” => “select Image folder” => “select Image.flow”, as shown in Fig. 5, Fig. 6.

 

Fig. 5. Select Image.flow.png

Fig. 5. Select Image.flow.

 

Fig. 6. Open Image.flow.png

Fig. 6. Open Image.flow.

 

After turning it on, set the image size and color you want to create in “Image_Create”.

 

※ If you just want to see the result of the execution, you don't have to set it.

 

※ If you want to see how to set it, please see the first point in Chapter 5.

 

Fig. 7. Set the created image size and color.png

Fig. 7. Set the created image size and color.

 

After setting the size and color of the image, you can press “Run”.

 

Fig. 8. Run the solution.png

Fig. 8. Run the solution.

 

 

  1. Chapter4: Open and run screenshot.flow

 

Please click “File” => “Open” => “enter the solution folder under OpenR8” => “select Image folder” => “select screenshot.flow”, as shown in Fig. 9, Fig. 10.

 

Fig. 9. Select screenshot.flow.png

Fig. 9. Select screenshot.flow.

 

Fig. 10. Open screenshot.flow.png

Fig. 10. Open screenshot.flow.

 

Press Execute to retrieve the picture of the current full screen.

 

Fig. 11. Execute the solution and Capture the full screen.png

Fig. 11. Execute the solution and Capture the full screen.

 

 

  1. Chapter5: Image.flow Process

 

This chapter focuses on the functionality of the Image.flow process.

 

Fig. 12. Image.flow process.png

Fig. 12. Image.flow process.

 

  1. Image_Create:

Create an image of the specified size and color.

 

width:Specify the width of the image as illustrated in Fig. 14.

height:Specify the height of the image as illustrated in Fig. 14.

channels:When set to 3, it represents a color image composed of three colors of blue, green and red.

               When set to 1, it represents a grayscale image.

colorB:If the channel is set to 3, it represents the blue tint in the color image. If the channel is set to 1, it represents the gray tones in the grayscale image.

colorG:If the channel is set to 3, it represents the green tint in the color image. If the channel is set to 1, no matter how much is set, it will not affect the grayscale image.

colorR:If the channel is set to 3, it represents the red tint in the color image. If the channel is set to 1, no matter how much is set, it will not affect the grayscale image.

image:Output the created image.

 

The relationship between channel and color, refer to Fig. 15.

 

Fig. 13. Image.flow - Image_Create.png

Fig. 13. Image.flow - Image_Create.

 

Fig. 14. Image_Create width and height.png

Fig. 14. Image_Create width and height.

 

Fig. 15. The relationship between channel and color of Image_Create.png

Fig. 15. The relationship between channel and color of Image_Create.

 

  1. Image_Show:

Displays an image of Image_Creat in a window.

image: Select the image that is output from Image_Creat.

displayPercentage: Displays the image zoom scale, which defaults to 100 (= 100% normal size) when not filled in.

windowTitle: The name of the window that is displayed.

 

Fig. 16. Image.flow - Image_Show.png

Fig. 16. Image.flow - Image_Show.

 

  1. WaitKey:

After the "Image_Show" must be added "WaitKey" to see the image, the image stay how many microseconds set.

KeyCode: The output keyboard code.

milliSeconds:If you want the image to close until any key is pressed, set 0, and if you want the image to be turned off after 1 seconds, set 1000, and if you want to turn it off after n seconds, set 1000 * N.

※1 second = 1000 mircoseconds.

 

Fig. 17. Image.flow - WaitKey.png

Fig. 17. Image.flow - WaitKey.

 

  1. Image_DestoryAllWindows:

Closes the image window displayed by all Image_Show.

  1. Println:

print “Flow completed.” in CMD windows.

 

 

  1. Chapter6: screenshot.flow Process

 

This section focuses on the functional content of the screenshot.flow process.

 

Fig. 18. screenshot.flow process.png

Fig. 18. screenshot.flow process.

 

  1. Sleep:

Sleep the program for a while.

second: Pause for a few seconds.

 

※Extend the applet: If you increase the number of seconds to pause, you can capture the picture after a few seconds!

 

Fig. 19. screenshot.flow - Sleep.png

Fig. 19. screenshot.flow - Sleep.

 

  1. Image_GetScreenshot:

Capture the function of the current full screen.

image: The output retrieves the image.

 

Fig. 20. Image.flow - Image_GetScreenshot.png

Fig. 20. Image.flow - Image_GetScreenshot.

 

  1. Image_Show:

Displays the image retrieved by "Image_GetScreenshot" in the window.

image: Select the image that is output from Image_GetScreenshot.

displayPercentage: Displays the image zoom scale, which defaults to 100 (= 100% normal size) when not filled in.

windowTitle: The name of the window that is displayed.

 

Fig. 21. Image.flow - Image_Show.png

Fig. 21. Image.flow - Image_Show.

 

  1. WaitKey:

After the "Image_Show" must be added "WaitKey" to see the image, the image stay how many microseconds set.

KeyCode: The output keyboard code.

milliSeconds:If you want the image to close until any key is pressed, set 0, and if you want the image to be turned off after 1 seconds, set 1000, and if you want to turn it off after n seconds, set 1000 * N.

※1 second = 1000 mircoseconds.

 

Fig. 22. Image.flow - WaitKey.png

Fig. 22. Image.flow - WaitKey.

 

  1. Image_DestoryAllWindows:

Closes the image window displayed by all Image_Show.

  1. Println:

print “Flow completed.” in CMD windows.

 


Recommended Article

1.
OpenR8 Community Edition - AI Software for Everyone (Free Download)