#Can someone explain the theoretical aspect behind image processing

45 messages · Page 1 of 1 (latest)

silk yarrow
#

Hello, can someone explain how image processing works in general pls.

I need to answer these questions using pullow in python:

b.    Swap Red and Blue → how does the image change?
c.    Extract the Green channel and compute its average value.
d.    Convert image to grayscale by averaging R, G, B.
e.    Image cropping – cut out the center 100×100 region.
f.    Blurring – apply Gaussian blur.

But I first wanted to understand the theoretical aspect of how images are processed. I know that images are sequences of bits and are made up using multi-dimensional matrix/vectors.

I know we need to use libraries like numpy so that we can upload the image to be processed.

First question, when we upload the image into that array, do we have pixels to work with?

I know images are made of 3 colors, RGB, how do they work?
Like if I need to swap red with blue, what's the idea behind that, convey all bits holding blue into red?

The colors have an average value, what does that mean pls

fallow lotus
fallow lotus
#

for swapping colors I think you mean like RGB to BGR

#

so the values in the red channel will be read as blue and vice versa

#

for grayscaling it's for cases where colors are not important

#

so we convert it to one channel for easier processing

fallow lotus
#

image cropping is for removing unwanted regions for more accurate results

#

blurring is for lowering contrast

#

averaging the values of the Green Channel may be used in certain cases

#

for example for detecting green objects in an image such as grass

#

if the average is high then there's a higher possibility that there are grass in the image and vice versa

#

I hope that answers your questions

silk yarrow
silk yarrow
fallow lotus
#

so if you swap the values of 2 color channels for example R and B then the values in the R channel will become the values in the B channel and same for B

#

so if an image have dark reds and light blues then it will have light reds and dark blues after swapping

silk yarrow
fallow lotus
#

if it's high then there's a higher possibility that the image contains grass

#

maybe sth like that

#

it's just an example

silk yarrow
#

yupp I see

#

last question :c

#

I had a homework where I needed to only include the red channel of an image.

So basically, image has 3 channels, red, green and blue

#

so I split the image into the 3 distinct channel and loaded only the red channel

#

surprisingly, I didn't obtain a red image but a gray one

#

is there a reason for that pls

fallow lotus
silk yarrow
fallow lotus
#

it's cuz it's only a single channel

#

to display it as red you must use all 3 channels RGB

#

and you can do a workaround by setting the values of the other 2 channels to all 0s

silk yarrow
#

oh ok

#

interesting

#

will try that later on and let you know, thanks for the explanation, really appreciate !

#

1 channel = grayscale = only shades of gray ?

fallow lotus
#

yes it can be understood like that

#

but in this case it's not the grayscale version of the original image

silk yarrow
#

oh ok, how is that different?

fallow lotus
#

cuz you only took the red channel

silk yarrow
#

yeah I see

#

will play around with an image and understand how the 2d array is internally, thanks for the insights !