Example: Change the Contrast of an Image

In this example we use the Edit - Style dialog to change the contrast of an image.

 

Before proceeding we have clicked on the ginevra image in the Project pane to highlight it and then we have quickly done a Ctrl-C followed by a Ctrl-V to copy and then paste the image, making a copy in the Project pane under the name ginevra 2.   

 

We have opened the image and have zoomed in to a close up view of the face.   

eg_style_image_contrast01_01.png

We press Edit - Style to launch the Style dialog.    The dialog tells us the image is a BGR image (almost always referred to casually as RGB),  and presents the three color outputs in the outputs and channels list.   The R output is driven by data Channel 2, the G output is driven by data Channel 1 and the B output is driven by data Channel 0.

 

 

eg_style_image_contrast01_02.png

 

To operate on outputs and channels we first click the R output to highlight it and then we issue a command.  In this example we will click each output in turn and then press Autocontrast to set the contrast.     In the illustration above we have changed the Autocontrast spread to 1.5 from the default 2 standard deviations and we will press Autocontrast.

 

eg_style_image_contrast01_02a.png

 

Next, we press the Update button to update the intervals list.

 

eg_style_image_contrast01_02b.png

 

Seeing the values in the intervals list we can gain understanding what increasing contrast means in an image.  The values in the list fall within 1.5 standard deviations of all values in the data channel, that is, they are the most frequently used.    The intervals list says to interpolate them into the full range of display output intensities from 0 to 255.  A number like 173, which would normally be only about two thirds intensity will now power the R output to full brightness of 255.   The net effect is to take a range of values that would have involved lesser brightness variations and to make them take effect with greater brightness variations, emphasizing the difference between what formerly were more similar darker and lighter tones.

 

After the above steps we could press Apply and apply the contrast change to the R output.   Instead we will first apply contrast changes to the G and B outputs as well, and then press Apply to show the image will all three outputs adjusted for greater contrast.

 

eg_style_image_contrast01_03.png

 

Next, we click the G output and channel to highlight it and then again we press Autocontrast.     The Range boxes still hold the old values from our work with the R channel (Manifold combo boxes tend to persist so we do not have to re-enter values during repetitive workflow like the 1.5 for the Autocontrast spread) but that is OK because pressing the Autocontrast button will command a re-computation from the values contained in data Channel 1 that is used for the G output.

 

eg_style_image_contrast01_03a.png

 

We press Update to update the intervals list.   Next, and finally, we alter contrast for the B output.

 

eg_style_image_contrast01_04.png

 

Finally, we click the B output and channel row to highlight it and then we press Autocontrast.  As can be seen, Manifold nomenclature for numbering channels is programming nomenclature where counting starts with 0 so the three B, G and R channels are Channel 0, Channel 1 and Channel 2.    We press Update to update the intervals list.

 

eg_style_image_contrast01_05.png

 

We press Apply to apply to the image the changes we have made to contrast to all three outputs.  

 

The first illustration below shows the application of the contrast, a harsh contrast using the 1.5 standard deviation setting.   The second illustration shows the original image before contrast changes, using the ginevra 2 copy we made.

 

eg_style_image_contrast01_06.pngeg_style_image_contrast01_11.png

tech_yoshi_sm.png

 

Tech Tip:  About now some users might be thinking "Hmm... this is a lot of overhead to just change contrast in a plain, old RGB image I loaded from a jpeg...."   Why so much infrastructure?   That is because Manifold can do much more than change contrast on RGB images:  Manifold can handle a vast array of different types of raster data.   Manifold can work with images that have dozens of data channels per pixel, like multispectral data acquired by satellite sensors.    How would we handle those with some dumb consumer editor that assumed images were always RBG or RGBA and changed settings for all outputs at once?  We could not.  To handle such data we need tools that provide controls and flexibility, like Manifold.  

 

Restoring the original coloring is easy.  We click each output row in turn to highlight it.  With the row highlighted for each we press the Full Range button to automatically load the full range of values for that channel and then we press Update to update the intervals list.

 

eg_style_image_contrast01_07.png

 

We click the R output row to highlight it and then press Full Range and then Update.

 

eg_style_image_contrast01_08.png

 

Next, we do the same for the other two output rows, clicking each row to highlight it and then pressing Full Range and then Update.

 

eg_style_image_contrast01_09.png

 

When we click Full Range for the third channel, Ch 0, we see that unlike the G and R channels the B channel only uses a range from 0 to 238.    If we wanted to restore the precise, original appearance of the image we could manually click into the Range box and change 238 to 255.   However, we will leave it as is and press the Apply button.

 

The first illustration below shows the subtle effect of applying the values in the B channel to the full range of output for the blue pixel on a monitor emphasizes the blue slightly.

 

eg_style_image_contrast01_10.pngeg_style_image_contrast01_11.png

 

The second illustration above shows the original, which has a slightly more yellowish cast.

 

Notes

eg_style_image_contrast01_12.png   

 

Ginevra de' Benci - Our sample ginevra image shows a close up of the portrait of Ginevra de' Benci by Leonardo da Vinci which hangs in the National Gallery of Art in Washington, DC, the only painting by Leonardo on public display in the US.

 

Painted when Leonardo was only 21, the portrait shows Ginevra at age 16 or 17, perhaps on the occasion of her betrothal or marriage, in what was for the time a revolutionary and lifelike pose, a three quarter view and not the more typical profile.  Ginevra already at 16 was known for her intelligence, her beauty and her virtue.   

eg_style_image_contrast01_13.png

 

il_windsor_hands_leonardo.pngThe details of the work, such as Ginevra's left eye seen above in a Zoom to Native zoom level, reveal the characteristically Leonardo genius for rendering the truth of anatomy with artistry in every fine detail.

 

The painting as we know it today has been altered from the original, with the bottom of the original painting cut away.   Based on other Leonardo works, preparatory sketches Leonardo had drawn at that age and his exposure to styles and work at the studio of his master and collaborator, Verrocchio, it is likely that the bottom portion of the painting which was cut away showed Ginevra's hands, perhaps in a pose that was a variation of the Leonardo sketch in the Windsor Castle collection, shown at right.   

 

The early history of the painting is unknown.  It became part of the collections of the Prince of Liechtenstein in Vienna most likely in 1712.  During WWII it was transferred to the Prince's castle at Vaduz and stored in the wine cellar for safekeeping.  The Ginevra portrait was purchased in 1967 from the reigning Prince for the then-record sum of $5 million by Alisa Mellon Bruce as a gift for the National Gallery of Art.   

 

At one time the portrait was attributed to Cranach, but for many years experts knew it had to be a Leonardo.  That Leonardo painted Ginevra was conclusively proved in 1991 when during a cleaning his thumbprints were discovered where he had pressed the surface of the paint to soften transitions.

 

il_imola_map_leonardo.png

A map of Imola, Italy, drawn by Leonardo da Vinci

 

Leonardo da Vinci. 1452 - 1519 - The portrait sketch at right by Francesco Melzi, Count of Lombardy, Leonardo's favorite student, is probably the best rendition of Leonardo late in life.   Melzi travelled with Leonardo to his final residence in France as a guest of François I. Leonardo bequeathed to Melzi his manuscripts, his tools and his artistic works, including the Mona Lisa, and named Melzi to be the executor for the rest of his estate. il_leonardo.png

 

Widely acknowledged throughout Europe as the most intelligent man alive, after early years in Florence at the court of Lorenzo de' Medici, "the Magnificent," Leonardo spent much of his life in Milan, first at the court of the Duke of Milan, Ludovico Sforza.  After the overthrow of the Duke in 1499 he spent time in Florence and also Milan.  Late in life, after three years working for Pope Leo X in Rome, in 1516 Leonardo moved to Amboise in France under the patronage of François I.

 

Leonardo lived at the small chateau of Clos Lucé provided to him by François, near the great royal fortress and chateau of Amboise, which was connected by underground tunnel to Clos Lucé.  Leonardo died on 2 May 1519 at Clos Lucé.

 

François was certainly aware of the great prestige attached to being Leonardo's patron and protector in his old age, but the stylish king by all accounts formed a genuine and sincere friendship with Leonardo, not surprising since few people of the era met Leonardo without immediately liking him.   Leonardo is said to have designed for François the impressive dual helix spiral staircase at the heart of the king's enormous chateau at Chambord.

 

Known today for his art and scientifically omnivorous notebooks, Leonardo spent much of his professional life at court designing great stages and decorations for parties and festivals, costumes, jewelry and other courtly frivolities.   He was as famous in his day for leaving artworks uncompleted as he was famous for the genius of his completed works.   A brilliant, kind man, he died a beloved savant to everyone who knew him.

 

il_st_hubert_amboise.png

 

Leonardo is buried in France at the royal fortress of Amboise on the banks of the Loire.   He is interred within the small, jewel-like chapel of St. Hubert, seen above, that juts out from the ramparts of the fortress high above the medieval town below.

 

Leonardo's grave is in the floor of the Southern niche of the chapel (behind the person seen at left in the photo above) which is by tradition and by sun angle the warm side of the chapel.   That niche and the small nave of the chapel both extend outside the cliff-like retaining walls of the fortress, perched on the buttress that supports the chapel high above the town below.  Leonardo literally is interred not in the earth but in the air, most appropriate for the first man to draw parachutes and flying machines.

 

il_st_hubert_leonardo.png

See Also

Images

 

Images and Channels

 

Palette Images

 

Style

 

Style: Presenting Images

 

Style: Autocontrast

 

Style: Palettes

 

Example: How Images use Tiles from Tables - An example showing how an image is made up from data stored in a table in tiles.

 

Example: Create Two Images From One Table - More than one image can show data from the same table, including from the same tile field.

 

Example: An Image using Computed Fields in a Table - How an image can be created from tiles where the data for the tiles is taken from a field that is computed on the fly.

 

Example: Use the BGR Button to Assign Channels - The BGR button in the Edit - Style dialog for images allows us to assign channels in the data to B, G and R outputs that create the displayed image, using BGR, RGB or Grayscale ordering.

 

Example: Assign Channels using Source - The Source control in the Style dialog for images assigns channels to display outputs such as R, G, B or A.  .  This topic shows examples of using Source and the visual results.

 

Example: Set Image Transparency using Alpha - The A row in the Style dialog allows us to specify what transparency we want to apply to the image, either by applying the same value for A for all pixels or by using one of the other channels to also control the A value.

 

Example: Autocontrast and Hill Shading Images using Style - This example shows how the Edit - Style dialog can hill shade an image using the values of pixels as heights and generating shadows as if the Sun were located at the specified azimuth and altitude.   This capability is used most frequently with raster images to give an impression of three dimensionality in cases where the values of pixels represent terrain elevations.

 

Example: Style Applied to an Image Server Image - Because the Edit - Style dialog simply changes the way an image is displayed and not the data, it can operate on read-only data served by various web servers such as WMS REST servers.    In this example we look at every detail of creating a data source using an image server and then manipulating the appearance of the display with Style.  We will connect to a WMS server that provides LiDAR data in various forms, including as terrain elevation.