I have a project Image processing. INPUT: gray Image salt_pepper, using Median filter
OUTPUT: Gray image after using Median filter. Problems: I don't know get pixels for gray image and set this.I want to support, please. Thanks.
This is gray image i need noise filtering.
Related
I was wondering whether or not you could apply a tint to a colored image to make a black and white version of that image. For example, having a landscape, applying a tint, and the new photo being only black and white. I'm dealing with an image that I cannot directly change the RGB pixel values for, which is why my only option is to overlay something on top of it. I attempted some Google searches, but to no avail, and unfortunately, I'm not an expert in color theory.
In essence, I'm looking for something that would accomplish this for any color:
COLOR + MAGIC VALUE = GRAY-SCALED (desaturated) COLOR
To be clear, 'magic value' is the color that I hope exists. Any help would be much appreciated!
TL;DR
There is no magic colour value that will do this for you.
The long version
Let's assume that the grayscale value for a pixel is equivalent to the average values of R, G and B.
If we represent the colour of a pixel as {R,G,B} and let's say you have a 2x2 image:
{10,20,30} {30,50,70}
{90,70,80} {90,130,110}
.. and you want to convert this to:
{20,20,20} {50,50,50}
{80,80,80} {110,110,110}
The magic values would need to be:
{10,0,-10} {20,0,-20}
{-10,10,0} {20,-10,0}
As shown, this magic colour value has to be different for each pixel (but can be calculated from the original image).
I got a Image Pixels array, the image is a grey scale image, which means the RGB are the same value. And I have the width and height of this image. I am going to replace the areas which equals or less than 2*2 with RED colour.
I had thinking about using (for each) to enumerate all the points in the image, and for each image, I check the 3*3 area of that pixel, check if this pixel is exactly less than or equals to 3*3, but I think this way is too stupid. Is there any other faster way to achieve this?
Thank you very much.
DATA EXAMPLE:
Image resolution: 2*2
Image Array: [255, 0, 255, 125]
I am currently working with a DICOM project in java. I am calculating the dicom values such as depth, off-axis ratio, width and height. I want to create a sample image with the calculated width and height. I should be a gray scale image, with varying densities of gray color in appropriate area. I have created a sample image with imagemagick, using concentric circles. Bit am not getting the exact image. It does not look like an actual dicom image. The variation of gray color does not have a linear behavior. Sample image is attached. Please suggest any other method to create dicom image. The density values are available in a list. depending upon the distance from the center, the gray color also changes according to the density value provided.
Pixel Data or image in DICOM data set is always rectangular and image is described using Rows (0028, 0010) and Columns (0028, 0011) attributes. So the best way to implement this is to draw your circular image on a rectangular background. Fill the background with a color that is not present in your image. Use the Pixel Padding Value (0028,0120) to specify the color used to pad grayscale images (those with a Photometric Interpretation of MONOCHROME1 or MONOCHROME2) to rectangular format.
If you do not have any color to spare (with-in the bit stored), you can add Overlay Plane or Display Shutter to the data set to mask the area that is not part of image.
here is sample java code which pixelates selected area on image.
pixelate sample in java
i want to achieve similar functionality in android.
searched a lot but dint find any example.
any help will be appreciated.
1.try to search for resize/re-sampling algorithms
like bilinear filtering ...
2.average color will do it too
make nested for loops x0,y0 through pixelated image (small resolution)
compute average color of the pixel area in source image (big resolution)
this is also done by 2 nested for loops x1,y1 through pixel area
just sum all R,G,B values separately
then divide them by number of pixels
store resulting color to pixelated image pixel(x0,y0)
[Notes]
if your pixelated image is the same resolution (or pixels' are area of pixels)
then instead of pixelated pixel fill entire pixel area by average color
I am developing a small program which cuts images by the color.
That's will be easiest to explain using this example image:
And I want to create a new image just with the purple form, without the black frame.
Does anyone have any ideas? I am using Java 2D so I think that I need to create an Object "Shape" with the purple area of the first image.
If the image is literally like the one you show, you could:
load the image into a BufferedImage (with ImageIO.read())
create a new BufferedImage of the same size, ensuring it has an alpha layer (e.g. set its type to BufferedImage.TYPE_4BYTE_ABGR)
"manually" go through each pixel in turn in the loaded BufferedImage, getting the pixel colour with getRGB() and checking if it's black
if the colour is black, set the corresponding pixel to transparent in the new image, else to the original colour from the first image (see setRGB() method)
save the new image (with ImageIO.write())
There are fancier ways, but this simple method is nice and understandable and will work fine for images of the type you showed.
You need to use some flood-fill algorithm that finds the boundries of the purple area:
Wikipedia has a page on it with excellent pseudo code and animations.
http://en.wikipedia.org/wiki/Flood_fill