Add Python examples to the random drawing tutorial (#31222)

* docs: add Python to the random drawing tutorial

* Match the Python drawing finale to the C++ saturating fade
This commit is contained in:
Viswesh
2026-12-01 15:50:11 +05:30
committed by GitHub
parent 94a5d75358
commit 7b6822aafb
3 changed files with 75 additions and 191 deletions

View File

@@ -44,6 +44,7 @@ int main( void )
/// Start creating a window
char window_name[] = "Drawing_2 Tutorial";
//! [setup]
/// Also create a random object (RNG)
RNG rng( 0xFFFFFFFF );
@@ -52,6 +53,7 @@ int main( void )
/// Show it in a window during DELAY ms
imshow( window_name, image );
waitKey( DELAY );
//! [setup]
/// Now, let's draw some lines
c = Drawing_Random_Lines(image, window_name, rng);
@@ -105,6 +107,7 @@ static Scalar randomColor( RNG& rng )
/**
* @function Drawing_Random_Lines
*/
//! [lines]
int Drawing_Random_Lines( Mat image, char* window_name, RNG rng )
{
Point pt1, pt2;
@@ -124,6 +127,7 @@ int Drawing_Random_Lines( Mat image, char* window_name, RNG rng )
return 0;
}
//! [lines]
/**
* @function Drawing_Rectangles
@@ -279,6 +283,7 @@ int Drawing_Random_Circles( Mat image, char* window_name, RNG rng )
/**
* @function Displaying_Random_Text
*/
//! [random_text]
int Displaying_Random_Text( Mat image, char* window_name, RNG rng )
{
int lineType = 8;
@@ -299,10 +304,12 @@ int Displaying_Random_Text( Mat image, char* window_name, RNG rng )
return 0;
}
//! [random_text]
/**
* @function Displaying_Big_End
*/
//! [final_text]
int Displaying_Big_End( Mat image, char* window_name, RNG )
{
Size textsize = getTextSize("OpenCV forever!", FONT_HERSHEY_COMPLEX, 3, 5, 0);
@@ -324,3 +331,4 @@ int Displaying_Big_End( Mat image, char* window_name, RNG )
return 0;
}
//! [final_text]