Determining rgb planes of a color image - image

What is meant by red,green or blue plane of a color image?How do we generate the red plane?how is it different from the other planes?Please explain the logic behind generating these planes?

Every pixel in a normal colour image is made up of a red part, a green part and a blue part - hence RGB image. Typically there is one byte for the red part at each location in the image, one for green and one for blue. As there is a byte for each pixel location, the red can vary between 0 (zero) which means "no red" and 255 which means "full red". Likewise the green and blue. So an image where all the pixels are
Red=255, Green=0, Blue=0 will look very bright red
Red=0, Green=255, Blue=0 will look very green
and a pixel where R=G=B will look grey, and if R=G=B=16 it will be very dark grey, and if R=G=B=240 it will be very light/bright grey.
So, the "red plane" is merely an image that only shows the red part of each pixel, or how much red there is in each pixel.
Here is a rose:
and here is the red plane, and you can see that where the rose is very red, the red plane is very bright meaning there is lots of red.:
Here is the green plane (you can see the green leaf on the right is bright):
and the blue plane (you can see the blueish petals on the left are bright):
If you want to separate the color channels (planes), it is very easy in ImageMagick to get the red plane, for example:
convert rose: -channel red -separate red.jpg
ImageMagick is free and amazing - available here.

Simple answer:
Say you read a 480x640 color image, like so:
A = imread('image.jpg');
The matrix A has dimensions 480 x 640 x 3. The third dimension are three 480 x 640 planes, or color channels:
red = A(:,:,1)
green = A(:,:,2)
blue = A(:,:,3)
Now you can go to the link #Trilarion gave in the comments and look at the portion about Truecolor Images.

If I understand your comment, you want to know how a CCD of a camera catch the chroma of each color.
Have a look to color space
And maybe about wavelength of colors (Look at the table of color frequency/wavelength for more informations)
And camera CDD to understand how camera catch those wavelenght and create color channel of an image.

Related

Morphological image processing

i am working on a project where i need to do some image processing, where i am not an expert.
I have an image obtained from QEMSCAN technology,as you can see here pink pixels represent the existence of the gold. there are 3 types of gold, type 1 where the connected pink pixels are surrounded with white ones. type 2 when the connected pink pixels are surrounded with white and another color.
type 3 where the pink area is connected with another colors except white.
I did some morphological image processing to isolate each area containing gold, but I'm blocked right now how i can determine to which type belong each pink area
thanks in advance
determine the type of gold
image
Here's a possible approach:
make all the pink pixels white and everything else black
do a dilation and find the coordinates of the additional pixels
check the colour(s) of the additional pixels in the original image

Detecting anti-aliased or undersampled text image

I have an image that is essentially a text document (black and white) but due to anti-aliasing/undersampling applied during scanning, the image contains a lot of color, light tone pixels and is thus saved as a full-color image i.e: takes a lot of space.
My goal is to be able to detect Black and White image candidates in order to convert them from full color to B&W which dramatically reduces their size.
Is there a way to detect such anti-aliased/undersampled images? Doing color pixel analysis doesn't help because the colored pixels end up being close in amount to the black pixels... Essentially I want to be able to detect that the colored pixels come from anti-aliasing/undersampling a black & white image and not from a picture type image.
Here is an example image:
As you can see there are many more colors than just black. However this image is a good candidate for Black & White / Greyscale conversion instead of full color. How can I detect such images? Please note that in this example the colors tend to be on the grey side but there are many cases where they are cyan or brown etc.
I think it is a valid question. I don't have 50 reputation to post a comment so I will post this as an answer.
Basically, in a black and white anti-aliased image the various grey colors are opacity differences of the black color. If we observe those pixels they will be like these listed below. So, if the operation is a color manipulation then apply the same opacity picked up from those grey pixels to the new color.
rgba(0,0,0,0.6)
rgba(0,0,0,0.9)
rgba(0,0,0,0.5)
rgba(0,0,0,0.9)
rgba(0,0,0,0.6)
rgba(0,0,0,0.1)
rgba(0,0,0,0.5)
In my opinion, the pixels other than grey, in this example image, cyan and brown as it appears can be safely ignored because they seemed like not part of the original text. If there were a few more example images of non grey pixels would have been good. But if we cannot ignore them just need to get the pixel opacity and apply the same color manipulation. In other words we treat them as black pixels.

Algorithm for smart floodfill in raster image

I'm trying to implement flood fill method for raster image.
For center pixels it's easy and works correct, but the problem is to fill pixels near border, which have different color.
For example, if draw Black figure on White background, some border pixels will have kind of gray color instead of black (for smoothing).
Image editors (like paint.net) during floodfill fixes it changing these pixels to some middle color between old and new one. Here I filled figure in red color, and gray pixels became in red gradient
I need to know method or algorithm how gray pixels became in kind of color to fill (here it's red, but can be any) using RGB pixel manipulation.
Thanks for any help.
So, for similar effect like in example we just need to use & operation between old and new color.
For RGB color:
resultColor.R = (byte)(oldColor.R & newColor.R);
resultColor.G = (byte)(oldColor.G & newColor.G);
resultColor.B = (byte)(oldColor.B & newColor.B);
If RGB color is Int number:
resultColor = oldColor & newColor;
It will not be exactly same color as in example below but pretty similar.

Additive blending of RGB colors representing light

I have a RGB color that represents light. I am looking for an algorithm to draw this over an arbitrary background (could be, for example, an image) in a way that simulates (or resembles) lighting.
Some examples:
RGB=#888888 represents white light at 50% intensity
Painting this over white (#ffffff) background pixels would do nothing
Painting this over black (#000000) background pixels would paint as #888888
Painting this over red (#ff0000) background pixels would result in a "lighter red"
RGB=#ff0000 represents red light at 100% intensity
Painting this over white (#ffffff) background pixels should result in a "light red" (mix of red and white)
Painting this over black (#000000) background pixels would paint as #880000
RGB=#000000 represents no light. Painting this over any background should have no effect.
I was hoping that I would be able to translate the original RGB color in (a set of) RGBA color(s) that I could paint over the background. I have been looking for an algorithm for this and playing around with HSL, HSB, alpha, etc. but cannot find a generic way to accomplish this.
Is there a generic algorithm to achieve what I want?
Update: I am aware of this question, but I don't think this is a duplicate (despite the similar names). The accepted answer to that question describes a behaviour (Red + Black = Dark red) that does not match this sceneario (lighting). I am specifically looking for an algorithm to simulate (colored) lighting.
If you view the values as decimal you have values that range 0-255. You could sum the two colours and then rescale them back to the range.
FF0000 + FFFFFF
= 255,0,0 + 255,255,255
= 510,255,255
Then scale this by 255/510 to
510 * 255/510, 255 * 255/510, 255 * 255/510
= 255, 127, 127
A light red as required.

Gray image from green channel

I was reading an article and they work on the gray image from green channel. They work with retina images and detect blood vessels on it.
My questions are that:
What does 'gray image from green channel' mean?
How can I get this gray image from green channel?
What is the difference between the gray image which is result of this matlab code I = rgb2gray(RGB) and gray image from green channel?
Thank you.
Just for fun, you can do it with ImageMagick which is installed on most Linux/Unix boxes and available for free for Windows and OSX like this:
Starting with this image:
convert plant.jpg -separate -delete 0,2 out.jpg
That separates the image into Red, Green and Blue channels, then deletes the Red and Blue channels leaving just the Green channel which then becomes a monochromatic (grey) representation of the amount of green in each pixel - so the green of the plant shows up the brightest/lightest.

Resources