Intensity profile of the pixels in a line of an image

Hello everyone, to study things complicated, we start first try with simple things. Below is the image origin with a drawn line, the intensity profile of the pixels in that line with OpenCV in C++. This article is to read an image, to retrieve the values of the profile of a line in this image, and we describe clearly the basic theory.

Or

Demo

rose_linerose_profilrose_his

Intensity profile of the pixels in a line of an image

In the demo, the profile image is the image in the centre. You can tell by the way, "intensity profile of the pixels in a line of an image" is a 1 d signal, the detail values of the colors in a line traced on an image.

Application for image analysis

We can use this line to analyze an image. In particular, for this image, when you see the profile image, we can focus 3 main parts: the first is the base part of left, the second is the upper part and the third is the part of right. The two base parts correspond to the two parts in black of the image. The second part is corresponds to a bet of the petal of the white rose. Change of amplitude
intensity represents the changing of the white of the petal. We can observe the sharp reduction in the amplitude of the intensity corresponds to a black trail on the petal.

Functions of program

This article is to read a color image and extract the values of the profile of a line. You will draw on the original image a line and then draw into a new separate image the profile of this line with OpenCV on C++. Then save then these two images in separate files. We do first with grey scale images. Then we could do with color images to have a look how it works.
To find the code, visit our Github: https://github.com/Booppey/ctimage.git
First you need to compile the program by execute

 make 

To use the program, you can tapper

./ctimage
Then: prof image_type image_path x1 y1 x2 y2

An example for usage of our program:
demo

Conclusion

This article shows you how to display the intensity profile of the pixels in a line of an image and its application to image analysis. That helps us so much to easier to understand an image.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *