Function getPhoto

This article is automatically translated from Russian by Google Translator.

Function description

The function returns a one-dimensional array of bytes containing the pixels of an rgb32-formatted image taken from the camera (image size 160x120). This function can be used to solve marker recognition problems.

Function call

var pic = getPhoto();

Work example

Let's look at an example of converting a frame taken with a camera to grayscale and black-and-white color formats.

Take a picture and display the result with the show function.

// take a frame in rgb32 format
var pic = getPhoto();
brick.display().show(pic, total_height, total_width, "rgb32");
script.wait(2000);

Rwsult:

Implementing the grayscale function

Converts the image to black and white and outputs it to the display:

Result:

Implementing the image binarization function

Translates the image to black and white and outputs it to the display:

Result:

Last updated

Was this helpful?