{"id":647,"date":"2023-04-18T14:03:47","date_gmt":"2023-04-18T18:03:47","guid":{"rendered":"https:\/\/brian.digitalmaddox.com\/blog\/?p=647"},"modified":"2023-04-18T14:03:47","modified_gmt":"2023-04-18T18:03:47","slug":"image-processing-basics-part-2","status":"publish","type":"post","link":"https:\/\/brian.digitalmaddox.com\/blog\/?p=647","title":{"rendered":"Image Processing Basics Part 2"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Some Examples<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have some of the basics down, let us look at some practical examples of the differences between how the brain sees things versus how a computer does.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573-768x1024.jpeg\" alt=\"Example image of a clear blue sky\" class=\"wp-image-648\" width=\"384\" height=\"512\" srcset=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573-768x1024.jpeg 768w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573-225x300.jpeg 225w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573-1152x1536.jpeg 1152w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573-375x500.jpeg 375w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/IMG_5573.jpeg 1536w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/a><figcaption class=\"wp-element-caption\">Example image of a clear blue sky<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The above photo of a part of the sky was taken by my iPhone 13 Pro Max using the native camera application. There were no filters or anything else applied to it. To our eyes, it looks fairly uniform: mainly blue with some lighter blue towards the right where the sun was the day I took the picture. Each pixel of the image represents the light that hit a sensor in the camera, was processed, and saved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our brain does not see a number of individual pixels. Instead, we see large splotches of colors. This is one of the shortcuts our brain does to ease the processing burden. If you look around a room, you do not see individual differences between the colors of the wall. Your wall mainly looks like a uniform color.  We simply do not have the processing power to break down the inputs from our eyes into every minute part.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A computer, however, does have the ability to &#8220;see&#8221; an image in all of its different parts. Computers see everything as a number, be it the 1\u2019s and 0\u2019s of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Binary_number\" target=\"_blank\" rel=\"noreferrer noopener\">binary<\/a> or color triplets in the <a href=\"https:\/\/en.wikipedia.org\/wiki\/RGB_color_spaces\" target=\"_blank\" rel=\"noreferrer noopener\">RGB color space.<\/a> If we look at the RGB color cube below, the computer sees all of the pixels in the above image as clustering somewhere around the lower right side of the cube. See the previous link for more information about the RGB color space.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/a\/af\/RGB_color_solid_cube.png\" alt=\"RGB Color cube from wikipedia\" width=\"553\" height=\"415\" \/><figcaption class=\"wp-element-caption\">RGB Color Cube (Wikimedia Commons contributors, &#8220;File:RGB color solid cube.png,&#8221; <em>Wikimedia Commons,<\/em> <a href=\"https:\/\/commons.wikimedia.org\/w\/index.php?title=File:RGB_color_solid_cube.png&amp;oldid=656872808\">https:\/\/commons.wikimedia.org\/w\/index.php?title=File:RGB_color_solid_cube.png&amp;oldid=656872808<\/a> (accessed April 18, 2023).<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">In a computer, the above image is loaded and each pixel is in memory in the form of triplets such as (135, 206, 235), which is the <a href=\"https:\/\/www.rapidtables.com\/web\/color\/RGB_Color.html\" target=\"_blank\" rel=\"noreferrer noopener\">code for a color<\/a> known as sky blue. The computer also does not have to take any shortcuts when it loads the image, meaning that the representation in memory is exactly the same as the image that was saved from the phone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we use the <a href=\"https:\/\/opencv.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCV<\/a> library to calculate the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Image_histogram\" target=\"_blank\" rel=\"noreferrer noopener\">histogram<\/a> of the image and then count the number of colors, we in fact find that there are 2,522 unique colors in the picture of the sky. There is no magic here, we just do not have the same precision that a computer does when it comes to examining images or our environment. The big take away here is this: <strong>there is more information encoded in pictures or video than what our brains are capable of perceiving<\/strong>. Just because we cannot see certain details in a image does not mean that they are not there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For another example, consider this image below. The edges look like nothing but black, and all you can really see is out of the window. It is definitely <a href=\"https:\/\/photographylife.com\/underexposure-and-overexposure-in-photography\" target=\"_blank\" rel=\"noreferrer noopener\">underexposed<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45-768x1024.jpg\" alt=\"Photo out the window of my wife's grandparents' house.\" class=\"wp-image-649\" width=\"384\" height=\"512\" srcset=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45-768x1024.jpg 768w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45-225x300.jpg 225w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45-375x500.jpg 375w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/Lichte-Farm-Pics-45.jpg 960w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/a><figcaption class=\"wp-element-caption\">Photo out the window of my wife&#8217;s grandparents&#8217; house.<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">As mentioned above, a computer is able to detect more than our eyes can. Where we just see black around the edges, there is in fact detail there. We can adjust the <a href=\"https:\/\/photographylife.com\/what-is-exposure\" target=\"_blank\" rel=\"noreferrer noopener\">exposure<\/a> on the image to brighten it so that our eyes can see these details.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1-768x1024.jpg\" alt=\"Above image with the exposure and contrast adjusted\" class=\"wp-image-651\" width=\"384\" height=\"512\" srcset=\"https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1-768x1024.jpg 768w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1-225x300.jpg 225w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1-375x500.jpg 375w, https:\/\/brian.digitalmaddox.com\/blog\/wp-content\/uploads\/2023\/04\/enhanced-1.jpg 960w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/a><figcaption class=\"wp-element-caption\">Above image with the exposure and contrast adjusted<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">With the exposure turned up (and adjusting the <a href=\"https:\/\/www.howtogeek.com\/725214\/what-is-contrast-in-photography\/\" target=\"_blank\" rel=\"noreferrer noopener\">contrast<\/a> as well), we can additionally see a picture of a bird, some dishes, and some cooking implements. This is not magic, nor is it adding anything to the image that was not already there. Image processing like this does not insert things into an image. <strong>It only enhances the details of an image so that they are more detectable to the human eye.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many times, when image processing is in the news, people sometimes assume that it changing an image, or that it is inserting things that were not originally there. When you edit your images on your phone or tablet, you are manipulating the detail that is already in the image. You can enhance the contrast to make the image &#8220;pop.&#8221; You can change the <a href=\"https:\/\/thelenslounge.com\/what-is-tone-in-photography\/\" target=\"_blank\" rel=\"noreferrer noopener\">color tone<\/a> of the image to make it appear more warm or more cold to your liking. However, this is simply modifying the information that is already in the image to change how it appears to the human eye.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am making a big deal about this point as future installments in this series will demonstrate how things actually work while hopefully dispelling certain myths that exist in pop culture. I think next time I will cover zooming in or out of an image (aka, resizing). Does it add something into the image or misrepresent it? We will find out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some Examples Now that we have some of the basics down, let us look at some practical examples of the differences between how the brain sees things versus how a computer does. The above photo of a part of the &hellip; <a href=\"https:\/\/brian.digitalmaddox.com\/blog\/?p=647\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[37],"class_list":["post-647","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-computer-vision"],"_links":{"self":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=647"}],"version-history":[{"count":4,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/647\/revisions"}],"predecessor-version":[{"id":655,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/647\/revisions\/655"}],"wp:attachment":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}