Capturing pixels from a selected part of an image

Im writing a tool to allow a user to drag a rectangle over any area of an image (contained on a ScrollingImagePanel) in order to perform an operation such as blur on the region.
When I have the co-ordinates of the rectangular area for the operation, how do I save the pixels to any sort of image object i.e a PlanerImage for manipulation?
Thanks

I'm developing a tool where one of the features is the one you describe. I haven't got it working yet, but I'm currently checking out createScreenCapture in java.awt.Robot. It creates a BufferedImage containing pixels from the screen. Might be what we're looking for :).

Similar Messages

  • Capture pixels from incoming NetStream.

    Hi
    I am using Action script 2.0, Flash CS4. Flash Media Server.
    Working on windows 7.
    I have read this tutorial.
    http://www.adobe.com/devnet/flash/articles/webcam_motion.html
    Its all working fine. I can put Pixel Effects on My Video Panel and it works fine when I broadcast my video using my web cam.
    I want to implement same effect on the Incoming NetStream. But when I try to implement same effects on incoming NetStream it throws Security Error that
    Connection to rtmp://localhost/videochat halted - not permitted from file:///D|/xampp/xampp/htdocs/MIKE/Test/clientAS2/videochat.swf
    I wonder why I can not capture pixels information using BitmapData for incoming NetStream ??
    is there anybody who worked on it .. or any information on it ..Or any alternative on it ... ??
    Thanks in advance
    Inderd

    come on somebody reply on it .. 

  • Selecting part of the image

    Hello,
    I have image present in ImageIcon. I want to select the part of the image in it using Mouse? I want to drag and select it....
    Can anyone help me in finding this?
    Thanks,
    Sri

    Geez, you post a question late Sunday night and want an answer early Monday morning. Contrary to public opinion many of us do have lives away from these forums.
    What have you done on this requirement so far? Can you display the ImageIcon? You can use MouseListener and MouseMotionListener to define the subimage to select.
    Start off with that and post specific questions for more detailed help.
    Cheers
    DB

  • Capturing data from a select many checkbox using adf components (11g)

    Hi
    I am new to this technology. Can anybody tell me how to capture the data selected in a checkbox
    I have created the checkbox(Af:selectmanycheckbox) using a webservice.
    Thanks,
    Tim

    Hi
    @Jonas : Thanks for the reply
    In the link its setting the values using a backing bean method lyk this
    <af:selectManyCheckbox label="Locations" id="smc1"
    value="#{sessionScope.weatherBean.locationsSelected}">
    <f:selectItems value="#{sessionScope.weatherBean.locationSelectItems}"
    id="si1"/>
    </af:selectManyCheckbox>
    but in my case am populating the values in the checkbox using a webservice
    <af:selectManyCheckbox value="#{bindings.result.inputValue}" --- result is the list binding while adding a webservice to the data control
    label="result" id="smc1">
    <f:selectItems value="#{bindings.result.items}" id="si1"/>
    </af:selectManyCheckbox>
    So for now am getting values like result red,blue green
    now if i want to select red and blue and display it in a text field on the click of a command button.*pls guide me how to save the selected value and display multiple values in a input/outpt text field*

  • Cropping a selected part of the image

    hi all i have sample codes here for cropping an image...how do i crop out the image automatically after i release the mouse button? Can anyone pls help me cos i need to know how it works...
    package MapWork;
    // import packages
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JPanel;
    import java.awt.Container;
    public class CropImage extends JPanel
         BorderLayout borderLayout1 = new BorderLayout();
         private Image img;
         Dimension d;
         int x, y, width, height;
         int startX = 0, startY = 0, endX = 100, endY = 100;
         public CropImage()
              super();
              setPreferredSize(new Dimension(800,500));
              try
                   jbInit();
              catch(Exception ex)
                   ex.printStackTrace();
         public void paintComponent(Graphics g)
              /* Graphics2D is a class for rendering 2-dimensional shapes, text and
              images in Java. It is used to construct the coordinates tranformations,
              colour management, layout of text etc...*/
              super.paintComponent(g);
              Graphics2D g2d = (Graphics2D)g;
              g2d.drawImage(img, 0, 0, this);
              // Math: to perform basic numeric operations. Math.min: return the
              // smaller value between the 2 integers
              int x = Math.min(startX,endX);
              int y = Math.min(startY, endY);
              // Math.abs: returns absolute value of a double value
              int width = Math.abs(startX-endX);
              int height = Math.abs(startY - endY);
              // draw rectangle, specify the x & y axis and the width & height
              g2d.drawRect(x, y, width, height);
              //g2d.setColor(Color.red);
              g2d.clipRect(x, y, width*2, height);
              // copy the selected area to another frame
              g2d.copyArea(x, y, width, height, width, height);
              g2d.setClip(x, y, width, height);
         private final Handler handler = new Handler();
         private class Handler implements MouseListener, MouseMotionListener {
         // occurs when mouse button is being pushed down
         public void mousePressed(MouseEvent e)
              setStartPoint(e.getPoint());
              // Repaint method(): issues a request that a Component be redrawn within
              // a specified time or as soon as possible if the time is left unspecified
              repaint();
         // mouseClicked: occurs when a mouse button is pressed and released
         public void mouseClicked(MouseEvent e){}
         // mouseExited:occurs when mouse cursor exits the unobscured part of
         // component's space/geometry
         public void mouseExited(MouseEvent e){}
         // mouseEntered:occurs when mouse cursor enters the unobscured part of
         // component's apace/geometry
         public void mouseEntered(MouseEvent e){}
         // mouseReleased:occurs when a mouse button is being released
         public void mouseReleased(MouseEvent e)
              setEndPoint(e.getPoint());
              // Repaint method(): issues a request that a Component be redrawn within
              // a specified time or as soon as possible if the time is left unspecified
              repaint();
         public void mouseMoved(MouseEvent e){}
         public void mouseDragged(MouseEvent e)
              setEndPoint(e.getPoint());
              repaint();
         public void setStartPoint(Point p)
              startX = p.x;
              startY = p.y;
         public void setEndPoint(Point p)
              endX = p.x;
              endY = p.y;
         private void jbInit()throws Exception
              addMouseListener(handler);
              addMouseMotionListener(handler);
              img = Toolkit.getDefaultToolkit().getImage("koyomi.jpg");
    }

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.event.*;
    public class CropIt
        public CropIt()
            final ImageEasel imageEasel = new ImageEasel();
            final ImageCropper cropper = new ImageCropper(imageEasel);
            imageEasel.addMouseListener(cropper);
            imageEasel.addMouseMotionListener(cropper);
            // make up ui panel
            final JButton
                newClip = new JButton("new clip"),
                reset   = new JButton("reset"),
                crop    = new JButton("crop");
            ActionListener l = new ActionListener()
                public void actionPerformed(ActionEvent e)
                    JButton button = (JButton)e.getSource();
                    if(button == newClip)
                        cropper.enableNewClip();
                    if(button == reset)
                        imageEasel.reset();
                    if(button == crop)
                        imageEasel.cropImage();
            newClip.addActionListener(l);
            reset.addActionListener(l);
            crop.addActionListener(l);
            JPanel north = new JPanel();
            north.add(newClip);
            north.add(reset);
            north.add(crop);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(north, "North");
            f.getContentPane().add(new JScrollPane(imageEasel));
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
        public static void main(String[] args)
            new CropIt();
    class ImageEasel extends JPanel
        private BufferedImage image;
        private Rectangle clip;
        private Area mask;
        private final int
            CLIP_WIDTH  = 100,
            CLIP_HEIGHT = 100;
        private boolean showClip, showCrop;
        public ImageEasel()
            loadImage();
            clip = new Rectangle(0, 0, CLIP_WIDTH, CLIP_HEIGHT);
            showClip = false;
            showCrop = false;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();
            int x = (w - imageWidth)/2;
            int y = (h - imageHeight)/2;
            g2.drawImage(image, x, y, this);
            if(showClip)
                g2.setPaint(Color.red);
                g2.draw(clip);
            if(showCrop)
                g2.setPaint(getBackground());
                g2.fill(mask);
        public void setNewClip(Point p)
            if(!showClip && !showCrop)
                clip.setLocation(p.x - CLIP_WIDTH/2, p.y - CLIP_HEIGHT/2);
                showClip = true;
                repaint();
        public void reset()
            showClip = false;
            showCrop = false;
            repaint();
        public void moveClip(int x, int y)
            clip.setLocation(x, y);
            repaint();
        public void cropImage()
            if(showClip)
                showClip = false;
                showCrop = true;
                mask = new Area(new Rectangle(0, 0, getWidth(), getHeight()));
                Area clipArea = new Area(clip);
                mask.subtract(clipArea);
                repaint();
        public Rectangle getClip()
            return clip;
        public boolean isClipVisible()
            return showClip;
        public Dimension getPreferredSize()
            return new Dimension(image.getWidth(), image.getHeight());
        private void loadImage()
            String fileName = "images/cougar.jpg";
            try
                URL url = getClass().getResource(fileName);
                image = ImageIO.read(url);
            catch(MalformedURLException mue)
                System.err.println("url: " + mue.getMessage());
            catch(IOException ioe)
                System.err.println("read: " + ioe.getMessage());
    class ImageCropper extends MouseInputAdapter
        private ImageEasel imageEasel;
        private Point offset;
        private boolean newClipEnabled, dragging;
        public ImageCropper(ImageEasel ie)
            imageEasel = ie;
            offset = new Point();
            newClipEnabled = false;
            dragging = false;
        public void mousePressed(MouseEvent e)
            Point p = e.getPoint();
            Rectangle r = imageEasel.getClip();
            if(imageEasel.isClipVisible() && r.contains(p))
                offset.x = p.x - r.x;
                offset.y = p.y - r.y;
                dragging = true;
            if(newClipEnabled)
                imageEasel.setNewClip(p);
                newClipEnabled = false;
        public void mouseReleased(MouseEvent e)
            dragging = false;
        public void mouseDragged(MouseEvent e)
            if(dragging)
                int x = e.getX() - offset.x;
                int y = e.getY() - offset.y;
                imageEasel.moveClip(x, y);
        public void enableNewClip()
            newClipEnabled = true;
    }

  • How to shrink selection by certain amount of pixels from the border?

    hi
    i'm not good using photoshop, i just installed the pre realease cs6 and trying to find a way of shrinking the marquee selection by certain amount of pixels from the selection border
    i found expand selection but it doesn't allow me to type nigative value plz help

    thank you so much guys you are very helpful
    just one more question :
    i found interesting thing, when you do Select > Transform selection and press alt+shift and drag mouse, it will shrink the selection from both sides but not evenly like this:
    [IMG]http://i40.tinypic.com/2mry3br.jpg[/IMG]
    plz any more tips on how to make it evenly
    thanks

  • How can I select only a small part of the image to clone or edit etc?

    I want to select part of the image to clone is, and just edit the selected part. I know i can do this on photoshop but how do i do it on Aperture?

    You use the "Retouche" brush in Aperture and set it to "clone".
    Option-Click on the location you want to clone from to select a source, and then brush over the location where you want to clone to. The cloned region will follow the shape of the brushed area. You do not lasso the shape to to copy and paste it like in Photoshop.
    For example: Duplicating a penguin: The sourcepoint has been set to the beak of the second penguin, and then I brushed along the path where I want to penguin clone to appear.
    If I brush the whole area eventually the penguin will be copied completely. You'll have to experiment a bit with the brush size and softnees to ensure that the cloned object will blend in.
    Regards
    Léonie

  • Adjusting Hue/Saturation for selected parts of image?

    1. Is there a way to adjust the hue/saturation for the Reds, greens or Blues in an image like you can in PS?
    2. Is there a way to make a selection and adjust the Hue/Saturation for just that selected part of the image?
    Thanks.

    The main toolbar is the one at the top of the program.

  • Selecting microphone when capturing video from the webcam

    Using Final Cut Pro X
    I want to capture video from my webcam into Final Cut.  I have a USB microphone (Yeti) with which I want to record the audio.  I cannot find an option to select my input source for audio when capturing this footage.  Final Cut seems to default to my microphone on my webcam, which causes echoing and noise. I can select the USB mic when doing a voiceover, but when I capture video I cannot find an option to select my input.  I've made my USB mic my default device in Sys Prefs, but that doesn't work.  Any other ideas?
    Options
    1.  Figure out how to change the default input for webcam capture in Final Cut
    OR
    2.  Use another program.  I've also tried to do the same in both QuickTime and iMovie, and they both capture audio only from the webcam as well.
    Everything I've found online talks about voiceover.  I don't want that.  I want to capture video with it.
    Suggestions are appreciated.  Thank you.

    acyclone wrote:
    Thanks.  Don't know why I didn't see it.  That arrow is pretty small.
    I do still have an issue that I cannot figure out.  I'm using the same mic for webcam recording (now in QT thanks to Luis) and in Final Cut for voiceovers.  Though I'm still on the same Mic the sound is not the same.  It's close, but the sound on the voiceover sounds cleaner and clearer.  I'm sitting in the same spot speaking the same way, but the sound quality difference is noticable.  Not sure why.
    It seems that the difference is in how each software deals with it.
    It may be that QT is sampling audio differently from FCP X somehow, or using a different audio codec or whatever.
    Just guessing, I really have no concrete knowledge.
    Oh, wait: there are a few things that I can notice, after trying a small example: the QT audio is AAC at 44.1 KHz,
    the FCP X is AIFF at 48KHz. Compression and sample rate are different.

  • How to capture a  charateristics value from a selected row in IP

    The requirements is to select a line in the summery layout and go to detail layout for further
    planning.
    In BPS, it's very easy to achieve this, since we can use the variables in the WIB to capture the value of selected line, In IP's query, after click a row, the selected row is highlight, but I am not sure how can we  pass the characteristics value of the selected row into a variable.  I did the following test by defining a variable for a account number characteristics in the row of a query, and define a dropdown filter with that account variable, after the query is launched in IP, when I click a row in the query, the account number dropdown filter value did not display the corresponding account number I choose. Anybody know how to achieve this?
    Thanks in advance

    Say your analysis item has 0material as one of the characteristics and say you can bind the material value on the selected line item to variable 'ZMAT' when the user clicks on a button. In the data binding section of the comand you want to perform when button is clicked you will make the fillowing settings:
    Variable - ZMAT
    Variable Type - 'SELECTION_BINDING
    Please give this a try.
    Regards

  • Free Transform multiple layers at the same time (only selected part)

    Hi,
    i have two layers - one contains color and second one contains outline. I want to select a part of the image and free transform both the layers at the same time. (so when i for example move or rotate the selected part of my example, both the color and outline moves at the same time). Layers must stay separated, process must be sort of quick, i would love to use this all the time when drawing etc.
    - Only way i managed to make this somewhat happen was to select the desired part of the image -> save the selection -> new layer via copy (on first layer) -> reselect the saved selection -> new layer via copy (on the second layer) -> select both of the new layers -> free transform. Warp doesnt work but other transforms do. But still this process is too slow and distracting even when having all the required commands hotkeyed. Is there a faster way?
    Any tips are welcome!

    @Trevor.Dennis
    i did understand, but as i said ctrl clicking the new layer only selects visible pixels in it, and my layers dont cover the whole canvas, especially not the outline layer, so ctrl click will only select that noodle of pixels and thats not usable in the other layer. (doing selection in the other layer first isnt a solution)
    Better description of what exactly im after:
    im manually drawing characters and i keep the their black "ink" lines/outlines on separate layer from the color layer. From time to time i want to transform small part of the character, lets say warp or rotate just its leg to fix or iterate, but i want to transform both the outline and color layer at the same time with that rotation so i see realtime how it looks. I would use this all the time if it was doable quickly. Transforms and puppetwarp are so powerful when drawing that as last resort i will have to switch to drawing everything on single layer.

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

  • Using applet to select a part of an image and then save it

    Hi ,
    I want to use applet to select a part of an image and then save that particular selected part to a server. can anyone provide me a code for this. I have found codes on the sun site which help in uploading an image but I am having trouble in trying to select a part of the image.

    Sorry to get back to you so late, but I was away from my computer this afternoon.
    I'm not sure just what you are after. I do see that you have positioned the tree on the labels. I went to the web site for the label company, and their instructions are not too helplful.
    http://www.pixentral.com/show.php?picture=15sBkl9OZE9xSkHoLMxgwjTFv2VCg1
    I changed the white portion of 1 label to black - - this can be any color. To do this use the magic wand tool, tolerance=10 worked for me, then go to Edit>fill selection.

  • What are the settings for capturing video from Canon HV20

    Hi All,
    I want to capture video from Canon HV20 with Premiere Elements 11. What kind of settings should I use to capture the video with full information?
    Here is what I did:
    1) According the manual, I went to Capture settings panel (Edit > Project Settings > Capture) and selected HDV as capture format, because my video is at high definition.
    2) In addition, I checked "Capture to Timeline" and "Split Scenes by cotent".
    Are these settings enough?
    Thanks.

    HV20user
    Sounds reasonable, using Add Media/HDV Camcorder, but....
    Have you reviewed the Adobe write up on Premiere Elements 11 DV and HDV capture firewire into it.
    http://help.adobe.com/fr_FR/premiereelements/using/WS5CDA0F91-60F1-4b79-ABF6-E9E75F498DB2. html#WS2AF26FB5-4C63-4c46-9DB3-7249558F6528
    The mention of Get Media instead of Add Media makes me wonder if the video's instructor was demo'ing from Premiere Elements 10, but...
    Major factors have always included having Premiere Elements project preset set correctly to correspond to your camera settings...For HDV data capture firewire...
    NTSC HDV HDV 1080p30 or PAL HDV HDV 1080p25 depending on if you are targeting a NTSC or PAL area where frame rates are typically a consideration.
    I had not done any DV or HDV data capture firewire into Premiere Elements. But, Premiere Elements 11's take over of the project preset setting would encourage me to encourage you to verify your project settings before the capture.
    There are probably many more, but the following is online discussion of one Canon HV20 issue
    http://forum.videohelp.com/threads/316970-video-capture-problems-HV20-camcorder-is-control led-but-no-video-capture
    If you experience difficulty with the HDV capture fireware into Premiere Elements 11, you might consider what some others have done in this regard, that is, use HDVSplit for the capture firewire and then import the split (.m2t) clips "Add Media" into Premiere Elements 11 with the appropriate HDV HDV 1080p (1440 x 1080 HD anamorphic 16:9) project preset.
    Please update us on your progress when you get a chance.
    Thanks.
    ATR

  • Capture Video from Panasonic AG-HMC40

    I am having trouble capturing video from my camera - Panasonic AG-HMC40 HD camera
    I keep getting a message:  Capture Device Offline.
    I am able to capture from iMovie and Final Cut X....
    Does anyone know the correct capture settings?

    You don't have to capture. You ingest.
    IE: Copy files from your camera memory card onto your hard drive using the media browser.
    See extract from Adobe Help below:
    Import assets from file-based sources with Media Browser
    You can import assets into Premiere Pro directly from tapeless media. However, it is more efficient to transfer tapeless media contents to a hard disk before importing. Also, playback performance is much better from a dedicated internal hard drive or RAID than from a camera or memory card reader.
    Use the Media Browser, instead of File > Import, to import files from tapeless sources. The Media Browser assembles the relevant files into coherent clips, and does not import irrelevant non-media files sometimes found in the folders of tapeless media.
    (Optional) Transfer the entire contents of one or more P2 cards, Sony Compact Flash cards, XDCAM media, XDCAM EX SxS cards, hard disk camcorders, DVDs, or AVCHD media to a hard disk. For information about transferring these media, see About transferring files.
    Note:  For XDCAM EX, copy the entire BPAV folder and its contents, not just one MP4 file at a time. 
    If the Media Browser is not already open, select Window > Media Browser. Note:  You can dock or group the Media Browser like any other panel in Premiere Pro.
    Browse to the folder containing the media files. The Media Browser shows a thumbnail or icon (depending on the format) and shot name for each shot in the folder. The Media Browser automatically aggregates spanned clips and shot metadata from the subfolders into single clips for any of these formats. The Media Browser shows different sets of metadata for different formats.
    (Optional) To preview a shot before importing it, double-click the shot in the Media Browser.  Premiere Pro plays the clip in the Source Monitor without importing it into the Project panel.
    Either select File > Import From Browser, drag clips from the Media Browser into the Project panel, or drag clips from the Media Browser into a timeline.
    The asset or assets are imported into the Project panel as whole clips.

Maybe you are looking for