O'Reilly logo

OpenCV Essentials by Jesus Salido Tercero, Julio Alberto Patón Incertis, Ismael Serrano Gracia, Gloria Bueno García, Noelia Vállez Enano, Mª del Milagro Fernández Carrobles, Oscar Deniz Suarez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting regions

Many computer vision applications require to focus interest inside local regions of the images. In that case, it is a very useful user tool to select the desired regions of interest (ROI). In the drawRs example, we show how to select, with the mouse, rectangular regions in the image to locally increase the contrast inside these regions (as shown in the following screenshot). For better control over region selection, we implement a click-and-drag behavior to reshape the rectangular boundary of each region.

Selecting regions

Output image with increased contrast in some rectangular regions

For the sake of simplicity, only the code corresponding to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required