Compute the image processing

Compute the image processing

Hi,

Question 1:

I have some questions here first I need some suggestion - I cannot find what went wrong with my code here to find the averaging of the image (grey image) also, How do i compute an average with a colour images one?

Question 2:
I need to compute the subtraction of the image using hte g(x,y) = |f1(x,y) - f2(x,y) How do i change the code so it will implement the subtraction by inputing two images in the Subtraction program?

Question 3:
I need to find the Brightness by adding the constant to all value which is
g'(x,y) = g(x,y) + k. Say k = 50.

Question 4:
Finding the contrast of the image by scale all value by constant of
g'(x,y) = g(x,y) * k. Say k = 1.5


Thanks
==========================================================================

import java.io.*;
import java.awt.image.*;
import java.awt.color.ColorSpace;
import javax.swing.*;
import com.pearsoneduc.ip.io.*;
import com.pearsoneduc.ip.gui.*;

public class AverageXImage extends JFrame {

private BufferedImage sourceImage;
private ImageView[] views;


public AverageXImage(String imageFile) throws IOException, ImageDecoderException {

super("xAverage: " + imageFile);
readImage(imageFile);

views = new ImageView[2];
views[0] = new ImageView(sourceImage);

Error found in this line---- views[1]=newImageView(average(sourceImage);

JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add(new JScrollPane(views[0]), "input");
tabbedPane.add(new JScrollPane(views[1]), "xAverage");

getContentPane().add(tabbedPane);
addWindowListener(new WindowMonitor());
}
public void readImage(String filename)
throws IOException, ImageDecoderException {
ImageDecoder input = ImageFile.createImageDecoder(filename);
sourceImage = input.decodeAsBufferedImage();
if (sourceImage.getType() != BufferedImage.TYPE_BYTE_GRAY) {

System.err.println("Converting colour image to greyscale image...");
ColorConvertOp op = new ColorConvertOp(
ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
BufferedImage greyImage = op.filter(sourceImage, null);
sourceImage = greyImage;
}
}

public BufferedImage average(BufferedImage[] imgArray) {
//instantiate a new image object

int n = imgArray.length;
int w = n*imgArray[0].getWidth();
int h = n*imgArray[0].getHeight();

BufferedImage AvgImage = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_GRAY);

for (int y = 0; y < h; ++y)
for (int x = 0; x < w; ++x){
//here is to save the original image
float sum = 0.0f;
for (int i = 0; i < n; ++i)
sum += imgArray[i].getRaster().getSample(x, y, 0);
AvgImage.getRaster().setSample(x, y, 0, Math.round(sum/n));
}
return AvgImage;
}
public static void main(String[] argv) {
if (argv.length > 0) {

try {
JFrame frame = new AverageXImage(argv[0]);

frame.pack();
frame.setVisible(true);
} catch (Exception e) {
System.err.println(e);
System.exit(0);
}
} else {
System.err.println("usage: java enlarge <imagefile> ");
System.exit(1);
}
}
}


View Answers









Related Tutorials/Questions & Answers:
Compute the image processing - Java Beginners
Compute the image processing  Hi, Question 1: I have some... code here to find the averaging of the image (grey image) also, How do i compute an average with a colour images one? Question 2: I need to compute
image Processing
image Processing   BCIF Image Compresssion Algorithm s alossless image Compression algorithm ,Pleas Help Me weather it can support only 24 bit bmp images
Advertisements
Image processing
Image processing  i want a browsing program in java in which we hv a small img and we hv to browse this img on a big image so that we can find the similar type of image in big img
image Processing
image Processing  Please give Me a JPEG or GIf "LOSS LESS" Image Compression and Decompression Source Code Please Help Me I don't want links Kindly help me Compression ratio not matter
image processing matching an 2 image
image processing matching an 2 image  source code for dense and sparse matching feature in lbp
image processing - Java3D
image processing  hii i have to compare 2 images. for this i try to convert image into greyscale. i think the greyscale comparisonn is more effective than that of colour. pls give me the processing details.  Hi friend
image processing in java
image processing in java  public class testing { static BufferedImage image; public static void main(String[] args) throws IOException...;Integer>(); image = ImageIO.read(new File("nn33.png")); int w
Image Processing Java
Image Processing Java  Using This Code I Compressed A JPEG Image And the Original Size of the image is 257kb and The Compressed Image Size Is 27kb...; import com.sun.media.jai.widget.DisplayJAI; /* * Shows how to save an image
jaav image processing
jaav image processing  hello there, i am an engineering student.. i am going to do and project in whcih the software provides the user... to destination over an image.. can you please guide me on how to start
ModuleNotFoundError: No module named 'alurinium-image-processing'
ModuleNotFoundError: No module named 'alurinium-image-processing'  Hi...: No module named 'alurinium-image-processing' How to remove the ModuleNotFoundError: No module named 'alurinium-image-processing' error? Thanks
ModuleNotFoundError: No module named 'gaia-image-processing'
ModuleNotFoundError: No module named 'gaia-image-processing'  Hi...: No module named 'gaia-image-processing' How to remove the ModuleNotFoundError: No module named 'gaia-image-processing' error? Thanks   Hi
ModuleNotFoundError: No module named 'smfish-image-processing'
ModuleNotFoundError: No module named 'smfish-image-processing'  Hi...: No module named 'smfish-image-processing' How to remove the ModuleNotFoundError: No module named 'smfish-image-processing' error? Thanks   
ModuleNotFoundError: No module named 'snovalleyai-image-processing'
ModuleNotFoundError: No module named 'snovalleyai-image-processing'  ...: No module named 'snovalleyai-image-processing' How to remove the ModuleNotFoundError: No module named 'snovalleyai-image-processing' error
ModuleNotFoundError: No module named 'alurinium-image-processing'
ModuleNotFoundError: No module named 'alurinium-image-processing'  Hi...: No module named 'alurinium-image-processing' How to remove the ModuleNotFoundError: No module named 'alurinium-image-processing' error? Thanks
ModuleNotFoundError: No module named 'gaia-image-processing'
ModuleNotFoundError: No module named 'gaia-image-processing'  Hi...: No module named 'gaia-image-processing' How to remove the ModuleNotFoundError: No module named 'gaia-image-processing' error? Thanks   Hi
Image Processing Tutorials in Java Programming Language
Tutorials and example of processing the image in the Java Programming Language Java Programming Language is providing many APIs for processing the image... image processing routine in the Java Program. This is available with JDK
compute
compute  B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds eight hours add 30% to each excess
compute
compute  B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage... Name, Rate per hour, No. of hours worked and will compute the daily wage
compute
compute    Write a menu driven program that will print out the results of the following : (1) Ceiling (2) Floor (3) Absolute (4) (a+b)^3 (5) Exit... at 25% Input the name and marks of 25 students and compute the average. Print out
how to make use of jerry's java image processing filter in java application?is there anyway to do this?
how to make use of jerry's java image processing filter in java application?is there anyway to do this?   how to make use of jerry's java image processing filter in java application?is there anyway to do
Compute command
Compute command  hello, What is compute command?   hii, samarADS_TO_REPLACE_1 Compute command control computations on subsets created by the BREAK command
data processing is
data processing is   data processing is   Data processing is associated with commercial work. Data processing is also referred as Information System. Data processing is basically used for analyzing, processing
image
image  how to add the image in servlet code
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
compute the average of degrees
compute the average of degrees  using c++ language , write a program to do the following 1 enter three degrees of a student by the user . 2 compute the average of his degrees
compute the daily wage of an employee.
compute the daily wage of an employee.   B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds
Steps for the payment gateway processing?
Steps for the payment gateway processing?  Steps for the payment gateway processing
compute the daily wage of an employee.
compute the daily wage of an employee.   B. Write a JavaScript... and will compute the daily wage of an employee. If the number of hours worked exceeds... and will compute the daily wage of an employee. If the number of hours worked
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
ModuleNotFoundError: No module named 'compute-hyperv'
ModuleNotFoundError: No module named 'compute-hyperv'  Hi, My... named 'compute-hyperv' How to remove the ModuleNotFoundError: No module named 'compute-hyperv' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compute-overtime'
ModuleNotFoundError: No module named 'compute-overtime'  Hi, My... named 'compute-overtime' How to remove the ModuleNotFoundError: No module named 'compute-overtime' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'numerai-compute'
ModuleNotFoundError: No module named 'numerai-compute'  Hi, My... named 'numerai-compute' How to remove the ModuleNotFoundError: No module named 'numerai-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compute_gc'
ModuleNotFoundError: No module named 'compute_gc'  Hi, My Python... 'compute_gc' How to remove the ModuleNotFoundError: No module named 'compute_gc' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'compute-overtime'
ModuleNotFoundError: No module named 'compute-overtime'  Hi, My... named 'compute-overtime' How to remove the ModuleNotFoundError: No module named 'compute-overtime' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'infrasim-compute'
ModuleNotFoundError: No module named 'infrasim-compute'  Hi, My... named 'infrasim-compute' How to remove the ModuleNotFoundError: No module named 'infrasim-compute' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'numerai-compute'
ModuleNotFoundError: No module named 'numerai-compute'  Hi, My... named 'numerai-compute' How to remove the ModuleNotFoundError: No module named 'numerai-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'civis-compute'
ModuleNotFoundError: No module named 'civis-compute'  Hi, My... 'civis-compute' How to remove the ModuleNotFoundError: No module named 'civis-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compute-hyperv'
ModuleNotFoundError: No module named 'compute-hyperv'  Hi, My... named 'compute-hyperv' How to remove the ModuleNotFoundError: No module named 'compute-hyperv' error? Thanks   Hi, In your python
compute the final grades
compute the final grades  C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks
ModuleNotFoundError: No module named 'processing'
ModuleNotFoundError: No module named 'processing'  Hi, My Python... 'processing' How to remove the ModuleNotFoundError: No module named 'processing' error? Thanks   Hi, In your python environment you
request processing in servlets
request processing in servlets  how request processing is done in servlets and jsp   Please visit the following links: JSP Tutorials Servlet Tutorials Here, you will find several examples of processing request
Processing Sequence of DispatcherServlet
In this section, you will get to know about the processing sequence of DispatcherServlet
Abort JSP processing
Abort JSP processing  Can I just abort processing a JSP?   Yes. You can put a return statement to abort JSP processing

Ads