Accessing image in more than one method

Hi,
I am trying to create an image manipulation system. For the purposes of the example I am trying to load an image into the system, and then within one method, call another to manipulate the image.
I am having problems with the accessing of the image. Here is the code:
public class imageRead3 {
public static Image blur(String begin) {
    String end = "blur_pred_1280.jpg";                                        
    ImageDecoder input = ImageFile.createImageDecoder(begin);
    ImageEncoder output = ImageFile.createImageEncoder(end);
    float sigma = 1.0f;
    BufferedImage inputImage = input.decodeAsBufferedImage();
    Kernel kernel = new GaussianKernel(sigma);
    System.out.println("Convolving with a " + kernel.getWidth() +
         "x" + kernel.getHeight() + " kernel...");
    ConvolveOp blurOp = new ConvolveOp(kernel);
    IntervalTimer timer = new IntervalTimer();
    timer.start();
    BufferedImage outputImage = blurOp.filter(inputImage, null);
    System.out.println("Gaussian blur finished [" +
      timer.stop() + " sec]");
    output.encode(outputImage);
    return outputImage;
  public static Vector doSomething() throws IOException {
     String begin = "pred_1280.jpg";
     Image image = blur(begin);  //This is where I am having problems.  I want to use this method to run a gaussian blur over the image.  I then want to use that blurred image within this method.
     int w = image.getWidth(), h = image.getHeight();
     ....do something with blurred image
  public static void main(String[] args){     
    try {
      doSomething();
    catch ( Exception e ) {
     return;
  }Now the blur method saves the blurred image file to disk. I want to be able to access it without saving it to disk first. Is there any way I can do this?
With thanks
N.

Well you got two potions
1 - pas it as an argument
2 - put it in member variable of the class.
but the best to do will be define a good class to represent your image and then write method on that class to manipulate it.
You can use the constructor to create an object of it and load the image and the call other methods to manipulate the image

Similar Messages

  • [Fwd: Client accessing MBeanHome for more than one domain receives SecurityException]

    Fwd'ing to security newsgroup
    -------- Original Message --------
    Subject: Client accessing MBeanHome for more than one domain receives
    SecurityException
    Date: 4 Mar 2004 07:27:33 -0800
    From: Dinesh Bhat <[email protected]>
    Reply-To: Dinesh Bhat <[email protected]>
    Organization: BEA NEWS SITE
    Newsgroups: weblogic.developer.interest.management
    Hi,
    When a client accesses MBeans of more than one domains (Weblogic 8.1)
    that have
    different passwords, it receives a SecurityException. This occurs when
    the MBeanHome
    for each domain is looked up at initialization and reused for each
    request ( to
    access MBeans ). The security exception does not occur if the MBeanHome
    for each
    domain is looked up for each request. On initial review, this behavoir
    seems inconsistent.
    Looking up the MBeanHome for each request may introduce a significant
    overhead.
    I am not sure if concurrent lookups would also cause the same problem.
    I have read on another post that we can work around this problem by
    establishing
    a trust relationship between the servers, but this may not be feasible
    when one
    is monitoring a lot of servers and the overhead of configuration may be
    an issue.
    I have attached code that can reproduce the problem.
    Please advise on the correct approach.
    Thanks
    Dinesh Bhat
    Panacya Inc.
    import java.util.ArrayList;
    import java.util.Set;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Hashtable;
    import javax.management.MBeanServer;
    import javax.naming.Context;
    import weblogic.jndi.Environment;
    import weblogic.management.MBeanHome;
    * This class reproduces the Security Exception that is caused when a client tries to access
    * MBeans of more than one domain with different weblogic passwords. Here is the stacktrace of the
    * exception
    * java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
         at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
         at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
         at weblogic.management.internal.AdminMBeanHomeImpl_811_WLStub.getDomainName(Unknown Source)
         at WLSecurityTest.getWeblogicInfo(WLSecurityTest.java:140)
         at WLSecurityTest.runTest(WLSecurityTest.java:75)
         at WLSecurityTest.<init>(WLSecurityTest.java:66)
         at WLSecurityTest.main(WLSecurityTest.java:51)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    Caused by: java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
         at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:682)
         at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:181)
         at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:814)
         at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:299)
         at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:920)
         at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:841)
         at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:222)
         at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:794)
         at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:570)
         at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
         at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    * Note: the exception is caused only when the MBeanHome for each domain is cached and used for subsequent
    * transactions. The exception does not occur if the MBeanHome for each domain is looked up for each transaction. This
    * would significant overhead in practice. Also the transactions across the various domains occurs serially, hence
    * the effect of concurrent lookups has to be tested.
    * Usage:
    * This class has been tested with weblogic 8.1
    * The class needs weblogic.jar in its classpath
    * One can specify the weblogic details as System properties. The properties need to be specified in
    * the following format:
    * wls.host.n, wls.userId.n, wls.password.n where n is the weblogix instance number. Also specify
    * the boolean system property reconnect.each.iteration to toggle between reconnecting or not reconnecting
    * for each iteration. When not reconnecting for each iteration, the MBeanHome is reused and the Security Exception
    * occurs.
    * Following is the example of system properties
    * -Dwls.host.0=localhost:7001 -Dwls.userId.0=weblogic -Dwls.password.0=weblogic
    * -Dwls.host.1=localhost:7011 -Dwls.userId.1=weblogic -Dwls.password.1=weblogic1
    * -Dwls.host.2=localhost:7021 -Dwls.userId.2=weblogic -Dwls.password.2=weblogic2
    * -Dreconnect.each.iteration=false
    public class WLSecurityTest
    ArrayList wlsDetailsList = new ArrayList();
    HashMap connectionMap = new HashMap();
    public static void main(String[] args)
    try
    WLSecurityTest wlSecurityTest = new WLSecurityTest();
    catch (Exception e)
    e.printStackTrace();
    * Constructor
    * @throws Exception
    public WLSecurityTest() throws Exception
    int noOfTries = 10;
    getWLSDetails();
    for( int i=0; i <= noOfTries; i++)
    runTest();
    * Runs the test
    private void runTest()
    for (int i = 0; i < wlsDetailsList.size(); i++)
    WLSDetails wlsDetails = (WLSDetails) wlsDetailsList.get(i);
    getWeblogicInfo(wlsDetails);
    * Get Weblogic details from System properties
    * @throws Exception
    private void getWLSDetails() throws Exception
    wlsDetailsList = new ArrayList();
    String hostKeyTmpl = "wls.host";
    String userIdKeyTmpl = "wls.userId";
    String passwordKeyTmpl = "wls.password";
    boolean done = false;
    for (int i = 0; !done; i++)
    WLSDetails wlsDetails = new WLSDetails();
    String hostKey = hostKeyTmpl + "." + Integer.toString(i);
    String userIdKey = userIdKeyTmpl + "." + Integer.toString(i);
    String passwordKey = passwordKeyTmpl + "." + Integer.toString(i);
    wlsDetails.hostName = System.getProperty(hostKey);
    done = (wlsDetails.hostName == null) || (wlsDetails.hostName.length() == 0);
    if (!done)
    wlsDetails.userId = System.getProperty(userIdKey);
    wlsDetails.password = System.getProperty(passwordKey);
    connect(wlsDetails);
    wlsDetailsList.add(wlsDetails);
    * Lookup the MBeanHome for the specified weblogic server
    * @param wlsDetails
    * @throws Exception
    public synchronized void connect(WLSecurityTest.WLSDetails wlsDetails) throws Exception
    Context ctx = null;
    MBeanHome mbHomeLocal = null;
    try
    Environment env = new Environment();
    env.setProviderUrl("t3://" + wlsDetails.hostName);
    env.setSecurityPrincipal(wlsDetails.userId);
    env.setSecurityCredentials(wlsDetails.password);
    Hashtable hashtable = env.getProperties();
    System.out.println(hashtable.toString());
    ctx = env.getInitialContext();
    wlsDetails._mBeanHome = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    catch (Exception e)
    e.printStackTrace();
    * Gets weblogic information using MBeans
    * @param wlsDetails
    public synchronized void getWeblogicInfo(WLSDetails wlsDetails)
    try
    boolean reconnectEachIteration =
    Boolean.getBoolean("reconnect.each.iteration");
    if( (reconnectEachIteration) || ((wlsDetails._mBeanHome == null) && (!reconnectEachIteration) ))
    connect(wlsDetails);
    MBeanHome mbHomeLocal = wlsDetails._mBeanHome;
    String domainName = mbHomeLocal.getDomainName();
    Set allMBeans = mbHomeLocal.getAllMBeans();
    System.out.println("Size: " + allMBeans.size());
    Set clusterMBeans = mbHomeLocal.getMBeansByType("Cluster", domainName);
    System.out.println(clusterMBeans);
    MBeanServer mBeanServer = mbHomeLocal.getMBeanServer();
    catch (Exception ex)
    ex.printStackTrace();
    * Class that holds weblogic server details
    class WLSDetails
    String hostName = "";
    String userId = "";
    String password = "";
    MBeanHome _mBeanHome = null;

    If Server version is 61.
    Make user "system" password of all weblogic servers same.
    If Server version above 61(70,81)
    In the Security Advanced Settings un check generated credential and specify a common credentail for all the weblogic servers(domains).

  • Is it possible to synch a folder (or image) over more than one LR catalog?

    For example: I have a Lightroom catalog for business photography and a Lightroom catalog for family - occasionally I will have photos that belong in both categories, I would like to have the originals accessible by both catalogs with changes made in either catalog synchronised to the other.
    I am using LR 5.6
    thankyou,
    Michael

    Sure you can... however you would be best to have just one catalog as it is tricky keeping files in more than one catalog in sync and knowing what changes have been made where and when.
    Try using different Collections for business and family. I have over 500k files in one catalog....I use collections for clients and other needs.

  • Making an int() return more than one method?

    hey people. i need an int, for example,
    public int someInt(){
    return 1000;
    }to return more than one number. To clarify, i need to be able to call the int() and it return me three different values. Is this possible?

    BigDaddyLoveHandles wrote:
    Word origins: guru
    Hmmm... "Heavy, weighty"
    Reminds me of a t-shirt my brother has. He's a rather portly gentlemen. The shirt has a picture of Buddha and the caption, "I have the body of a god."

  • Can I access icloud with more than one Apple ID account on an ipod touch?

    I just bought a new ipod touch and would like to know if I can download past purchases from my fiances Apple ID account using icloud on the ipod touch we are going to share because I am having a problem with being unable to authorize the one macbook computer that we share with both of our accounts. As a solution I was thinking about logging into his account on icloud on our ipod touch and downloading his purchased apps. Will this work?? Thank you so much for reading this I appreciate all and any responses you may leave me.

    You can do that, but if you switch back to the other account, you'll lose everything bought from the first account. We're talking about an iTunes account. You do not want to share the same iCloud account otherwise you both get the same emails, contacts, messages, calendars, etc if you turn those services on for iCloud.

  • Can not access control center-more than one way to turn off and on portait rotate?

    The very bottom of my screen does not register touch for some unknown reason ( I have a 4s and iOS 7.1)—however I've been dealing with that by rotating my phone to pull up the keyboard to type for text messages, etc. I accidently locked my ability to rotate my phone and now I can't pull up the control center to turn it off. Is there another way to access this function?

    Thank you for the quick response. Unfortunately, in the AssistiveTouch there is still no way to turn off the locked position of my screen, so when I click the different rotate options provided, the screen does not change orientation... any thoughts?

  • Accessing email from more than one device

    Finally have all my devices up todate. Iphone, Ipad and imac. How can I access me @me.com mail from all three? All I have been able to find is that it is difficult. But is it impossible? Can someone help?
    Thanks

    on a device:  go to Settings>Mail, Contacts, Calendars, in the Accounts section, Add Account and enter the icloud ID and password to set up the mail account.  If you already have an icloud account there, you should be getting emails.  If not, delete that account and start again.  You won't lose emails, since they are store on icloud.

  • Combining more than one method

    Hi all,
    I am trying to combine the below method 3 times and piece together the resulting characters (ieAAA),
    Random rand = new Random();
    int num = rand.nextInt(10);
    char myChar = (char) ('A' + num);
    System.out.println("The random string is: "+myChar);
    I have tried,
    Random rand = new Random();
    int num1 = rand.nextInt(10);
    int num2 = rand.nextInt(10);
    int num3 = rand.nextInt(10);
    char myChar1 = (char) ('A' + num1);
    char myChar2 = (char) ('A' + num2);
    char myChar3 = (char) ('A' + num3);
    System.out.println("The random string is: " myChar1, myChar2, + Char3 )
    Obviously does not work. Any suggestions?
    Stona

    well, the problem is that you are using commas in the last statement, try this:
    Random rand = new Random();
    int num1 = rand.nextInt(10);
    int num2 = rand.nextInt(10);
    int num3 = rand.nextInt(10);
    char myChar1 = (char) ('A' + num1);
    char myChar2 = (char) ('A' + num2);
    char myChar3 = (char) ('A' + num3);
    System.out.println("The random string is: " +myChar1 + myChar2 + myChar3);Or if you want, it may be:
    Random rand = new Random();
    String string = "";
    for (int i = 1; i <= 3; i++) {
         int num = rand.nextInt(10);
         char myChar = (char) ('A' + num);
         string = string + myChar;
    System.out.println("The random string is: " + string);

  • Filtering content in Bridge using more than one keyword.

    Hi,
    I have thousands of images in one master folder on an external hard-drive. I have applied many keywords to the images but I cannot find a way to filter the images any more than one layer deep. Some images have more than one keyword applied and I would like to be able to exclude one of those keywords from the search to reveal the other.
    For example, I have 300 images that all have the keyword "Arroway" (Arroway is the content provider FYI). 150 of these images have the keyword "Concrete" assigned, the other 150 have "wood" applied. I would like to be able to sort by Arroway, and then by material type. Is this possible?

    Not by filtering but doable with  Edit  > Find
    Or you could make a Smart Collection.

  • More than one Thread accessing the same records in the database

    Hi, I have more than one thread accessing a synchronized method called getMinPrimaryKey() which gets the lowest of the primary key frm the table based on the a flag which is set to true. once it is retrieved the same method also sets the flag as false so it is not retrieved the second time. so next time a different thread calls this method it should retrieve the next available lowest primarmy key.
    but even when i have the method as synchronized different threads keep returning the same primary key instead of getting the next sequence. can some one let me know where I might go wrong and what could be the solution. is it because when once i retrieve the record and set the flag as false, i also need to commit it?, which could be the reason the select query still picks up the same primary key. please help me out on this.
    thanks,
    Harish

    Correction. If different threads always return the same key then your table isn't getting up dated. If different threads sometimes return the same key, then either the database is committing lazily, or else the threads are calling getMinPrimaryKey on different objects and so are not executing atomically with respect to each other.

  • Error - Can't open more than one image in CS3

    My Photoshop CS3 was working fine until all of a sudden it no longer lets me open more than one image at a time without crashing. Anyone else have this problem? How do I fix it?

    Hi,
    There may be two issues you have to check:
    1) The " scratch disk" feature in photoshop(usually gets full). Go to preferences - performance. Also check how much RAM PS is using.
    2) Printer Communication: sometimes Photoshop is unable to communicate with the default printer(may be unstable drivers, out of date etc). Network computers also make some issues
    If you want to read more about this follow this link:
    http://www.fluther.com/disc/22453/photoshop-cs3-not-opening-more-than-one-image-at-a-time/
    They talk about the issues I mentioned here. Let me know if you found this information useful.
    Vicente Tulliano

  • In Keynote, how do I put more than one image on a single slide?

    I would like to put 2, 3, or 4 “pictures” on a single slide, and program them with transitions so that they could pop-on or dissolve one at a time.  Is it possible to put more than one image placeholder on a slide?

    Yes. Just copy-paste the placeholder that the theme has, multiple times.

  • Can one add more than one photo layer to a draw image?

    I cannot seem to find a way to add more than one photo or photo layer to a Draw image, but the Draw page on Adobe seems to imply multiple photos can be added. How might I accomplish this? Thanks for your time.

    Unfortunately, Draw is currently limited to one photo layer, and only one photo within that layer.
    Hope that helps,
    Frank
    Draw Engineering

  • How to show more than one image on my screen at same time?

    I recently upgraded to PS-CS4 from CS3 and notice that I can only view one image on my screen. Is there a way to view more than one image on the screen at the same time? I cannot seem to find a way to change this feature.
    Thanks, Richie

    John Joslin wrote:
    In addition, if you don't like the tabs, select Float All in Windows from the Arrange Documents drop-down in the Menu bar up top.
    Or keep pressing the F key.
    The drop-down bar also has a conveneint way of fitting multiple images on the screen. See the illustration below:

  • I use more than one computer to access my four business email accounts. When one computer is on (and mail is open) emails do not get through to the other computers. This is fine, but how do I make one of the other computers the dominant one?

    I use more than one computer to access my four business email accounts. When one computer is on (and mail is open) emails do not get through to the other computers. This is fine, but how do I make one of the other computers the dominant one?

    I assume these are POP accounts and all computers are set to remove from Server after downloading.
    So on the non dominant ones... Mail Preferences>Accounts, highlight an account, Advanced tab, uncheck remove from Server, just have the main dominant one remove from server.
    Or get/setup IMAP accounts.

Maybe you are looking for

  • Win8.1 - Error when using traceview "PDB file does not contain provider information"

    We have been attempting to manage a Windows 8.1 machine by using the Enterprise Device Management Protocol. We are encountering a failure during the process and would like to inspect what is going wrong on the Client Side. Used the "Windows 8.1 Enter

  • Check if element/object is valid

    Hi folks, Can I programatically say if an object is valid or not? Today, i'm returning true(1) or false(0) in the Validate event of the object but I want to do it using API/Programatically, for example, I have a TableRow1 and I want to do something l

  • Buttons have ceased to respond on Adobe Presenter 9

    Having previously worked fine one of my colleagues is experiencing an issue with Presenter 9. He is using PowerPoint 2010. The buttons are showing on the ribbon but when selected nothing happens. For example he will click on the manage button on the

  • Where can i find the created group in portalcontent of content admin?

    Hi all, I have created a group with name Group1.  I assigned some users to the group one by one.  Is there any method to add 5 users at a time? How can i store the created groups in the folder & where can i find the Group1in the portalcontent? thanks

  • Issue opening a MPP File ("&Gantt" View)

    Today I am encountering the following issue when I open the MPP file using Project Online. I was able to make updates, checkin and publish the project plan without any issues a couple of days back. Below is a screenshot of the issue. Even if I were t