Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
JUHI. A. GIANANI
DIV – C2 , ROLL NO 31
Image Negative
Code:-
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
class Negative
{
public static void main(String args[])
{
File f = new File("/home/lab405pc19/Desktop/rose.jpeg");
catch(IOException e)
{
e.printStackTrace();
}
}
}
try
{
f = new File("/home/lab405pc19/Desktop/new.jpeg");
ImageIO.write(img, "jpg", f);
}
catch(IOException e)
{
System.out.println(e);
}
}
}
Output:-
Code:-
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
class Scaling
{
public static void main(String args[])throws IOException
{
BufferedImage img = null;
File f = null;
int height,width;
int x,y;
int r,g,b,p,q;
int min=40,max=160;
}
catch(IOException e)
{
System.out.println(e);
}
//Negation
for(y=0; y<height; y++)
{
for(x=0; x<width; x++)
{
p = img.getRGB(x,y);
q = (r+g+b)/3;
Output:-
Thresholding
Code:-
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
class Thresholding
{
public static void main(String args[])throws IOException
{
BufferedImage img = null;
File f = null;
int height,width;
int x,y;
int r,g,b,p,q;
int threshold = 90;
}
catch(IOException e)
{
System.out.println(e);
}
//Negation
for(y=0; y<height; y++)
{
for(x=0; x<width; x++)
{
p = img.getRGB(x,y);
q = (r+g+b)/3;
Output:-