In obniz's block program, you can also use a block called image analysis such as "A person is in the picture!" Using a camera.
Let's use it this time.
Use the camera
There is a type of block called AI.
You can use blocks such as whether or not a person is shown in this.
Of course, I will use the camera, but I will use the camera attached to the smartphone or computer running this block program.
If you don't have a camera, you can't use it.
First, erase all the block programs and start from the state of nothing.
Place "Prepare Camera" inside the AI block.
If you use a camera, you need to prepare by doing this once.
Then, if you see your face on the camera, try to display "Who?" On the console.
For that, we use a loop.
Make sure to repeat the loop and check in the "if" block.
What you check is "Your face is in the camera" in AI. Put this in the condition of if.
Then put the console in the UI inside something and say "Who?".
It will be a block like this.
Since it does not use the obniz block, it can be used immediately without obniz.
Now let's try to run this.
After waiting for a while, you will see a permission screen like this one: "The site is trying to use your camera, are you sure?
The design of the screen is different for each machine you are using, whether it is a PC or a smartphone.
By pressing "Allow", the camera will move and you will see your face on the screen.
As long as your face is on the screen, you will continue to see "Who? will continue to appear on the console.How about this?
if you cover the camera with your hand so that your face is not visible, it will stop coming out.
To make it work, you need to take a clear picture of the face. For example, let's try this in the following situation.
・Not bright enough -> Brighten the room
・Backlighting (the sun, fluorescent lights) -> Change the direction and angle of the camera.