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
Related
I'm a newbie for Adobe XD and I was trying to fill different color for each section on a square, where square is divided by a single line. When I'm trying to fill it, it's automatically fills all over the square.
Please use a gradient for multi-color in a box.
See the below pic
You need a gradient that starts with a red color for example, then at the middle position add another red color. Next to it a blue and at the end the blue color again.
To translate this to positions that would be:
red at 0%
red at 50%
blue at 50%
blue at 100%
This will create a gradient with 2 colors, but instead of gradually fading from one to another, you have a harsh jump at the 50% position from red to blue.
How to change a Golang image.Image's white background to transparent?
I want to put the white background into a translucent color, do you have any suggestions?
This is not possible in general but there are heuristic approaches to attempt this.
Why is it not possible?
If the original image had some transparent pixels and was rendered on a plain white background (or any known background) then in the resulting image there is lost information. For example, is a pink pixel created from a red pixel with some transparency or a truly pink pixel without transparency?
Even a pure white pixel may have been fully white originally, or fully transparent, or somewhere in between.
Heuristic approaches
If you know something about the original image or can infer something by looking at it you may be able to deduce what colour and transparency of the original pixels was. A simple first step is that if the outside pixels are white then you might want to flood fill this area with fully transparent pixels. Also white areas inside coloured areas may be holes that can also be transparent.
Next you can infer the colours of border pixels around objects of a single colour (assuming transparency was used for anti-aliasing). For example for a red circle with pink pixels on the circumference it's likely they were originally red with some transparency leading them to be rendered in different shades of pink. For more complex, multi-coloured shapes you can get a reasonable result by manually editing the image using judgement, knowledge/guesswork of the original image and knowledge of how anti-aliasing was performed.
I wrote a Paint.Net plugin (C#) to automate this sort of thing many years ago and sometimes it gave reasonable results, but often you need to do it by hand.
package "image" has Decode function
func Decode(r io.Reader) (Image, string, error)
image.Image is interface
type Image interface {
// ColorModel returns the Image's color model.
ColorModel() color.Model
// Bounds returns the domain for which At can return non-zero color.
// The bounds do not necessarily contain the point (0, 0).
Bounds() Rectangle
// At returns the color of the pixel at (x, y).
// At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid.
// At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.
At(x, y int) color.Color
}
after you decode you file into image.Image, you can get Height and Width from Bounds(),and color from At(x,y).
So, here is what to do next:
make another image with alpha channel,
Iterate throw whole image one pix by another,
check color, copy color to new image after you do whatever you want.
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.
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.
Is there a way to detect a circle with a specific grey level using openCV? I want to detect a circle that marks out from the others.
Currently, I'm using cvHoughCircles to detect my circles. I know the method returns an array of cvSeq containing the info on each circle (point and radius), but it does not provide any color information.
Thank you
You should first isolate the colour you want, and then do a houghcircles on that image.
Say you want to find green circles from a bunch of green, red and blue circles. Its simple in this case, just threshold the green channel. You'll get only the green circle in the thresholded image. Do a sobel/canny on it and execute houghcircles.