Site icon Learn C++

How To Analyze Video Camera Images In C++ Builder On Windows

C++ is a strong and faster programming language, this feature really important on dynamic operations running less than in milliseconds of intervals. C++ is one of the best to analyze video camera images, it is good to analyze video image operations by using very modern methods of programming.

In C++ Builder, it is easy to use camera of device and easy to to capture video camera images by using CameraComponent with it’s FireMonkey UI framework. There is a video camera sample in Samples folder., please check details here before you start coding.

This small example below show how to use CameraComponent. You just need to add an Image component to show camera buffer and drag CameraComponent on your C++ Builder Project Form and double click on CameraComponent to add OnSampleBufferReady event, add lines as below;

[crayon-6606bec119908744819885/]

After this step you can analyze Bitmap of Image1. You can analyze the image inside of this OnSampleBufferReady event. If your analyze takes much time, camera display may have delays while viewing actions, you can analyze this image in another Timer(), so your video frames will be more smoother while analyzing image takes much more time. That means you will pass some of frames to analyze, you will just show it.

In C++ Builder, Multi-Device FireMonkey projects are really good on Bitmap operations, we highly recommend FMX on Video Camera Operations, You can use same code on Windows, MacOS, iOS and Android. VCL Projects are also can be done in same way. FMX has locking Bitmap Data and reading mapped pixels are much more faster and it is possible to analyze or operate on Bitmaps.

In this example, this procedure can be used to find mean color of an image in a given rectangular area.

[crayon-6606bec11990e609692230/]

Now lets add a ColorBox on the form to show this calculated mean color. We can use this mean color procedure on the bitmap of image. Please update the first code to show mean color of camera image as below.

[crayon-6606bec119911605030177/]

This simple example can be applied to analyze images that is called image processing. Nowadays it is very important to analyze faces, people, motions etc. You can use this to analyze or to control things and to do effects for fun. l. You can also add more complex algorithms like Deep Learning methods or other Artificial Intelligence Technologies.

Exit mobile version