Get pixel coordinates in image with mouseclick

Hey there
Im a beginner at labview, so i walked into a little problem.
I want to know if there is a way to get pixel coordinates from an imagefile with a mouseclick in labview, this is to use the coordinates in order to calibrate the image without using the vision assistent.
THx with regards
jens dassen

I'm not sure if this is something new with newer versions of LabVIEW, but I just solved this problem using a property node for the image indicator. See images below. Super easy!
Cheers!
James
LabVIEW Professional 2014
Attachments:
Capture.PNG ‏8 KB
Capture1.PNG ‏5 KB

Similar Messages

  • Getting pixels from an image

    I'm currently writing a Java3D-based renderer for terrain data. The rendering engine works great, and I've tested it with OS DEM files.
    I thought it would be neat to code a class similar to the one I use to parse DEM files, but that takes Jpeg images and specifies altitude from the brightness component of the HSB of each pixel. This is where the problem begins.
    I (naively) thought it would be a simple case of getting the image with something like
    Image image = Toolkit.getDefaultToolkit().getImage(fname);
    Then using a getColor(x,y) or similar method to get the data out of the image. Only it doesn't seem to be so simple. It looks like I need to use a BufferedImage, which in turn wants a Raster, which wants two other classes.... and the whole thing gets complicated.
    If anyone knows a quick (hoping it's a 3 or 4 line thing) way to set up an object that can be readily accessed to read the HSB value of each pixel (ideally by returning it as an awt.Color class), I'd really appreciate it. Or a link to a good tutorial on the subject.
    Thanks.

    Thanks :) Knew it should be simpler than it looked :)

  • IPhone: How to get the original photo image with  Picker

    Hi!
    I'm trying to pick and send (via HTTP) the original image taken by the camera, the 1,600 x 1,2000 image that's available in iPhoto after syncing.
    As far as I gathered, the UIImage doesn't help me here, since it's scaled down to 640x480, probably to safe memory. But one should supposedly be able to access the underlying CIImage.
    Here's what I'm doing right now:
    I'm setting up an ImagePickerController in my
    - (void)viewDidLoad
    imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    [self refreshView:self];
    and process the picked image with
    - (void)imagePickerController:(UIImagePickerController )picker didFinishPickingImage:(UIImage )image editingInfo:(NSDictionary )editingInfo
    CGImageRef imgRef = image.CGImage;
    CGFloat owidth = CGImageGetWidth(imgRef);
    CGFloat oheight = CGImageGetHeight(imgRef);
    NSLog(@"Original size = %f %f",owidth,oheight);
    NSData imageData = [NSData dataWithData: UIImagePNGRepresentation(image)];//(image, 1.0)
    However, I still get the following output:
    2008-07-25 11:44:58.543 myApplication[1564:20b] Original size = 640.000000 480.000000
    Obviously still scaled down - but there must be a way to access the original.
    What am I doing wrong?

    Yes, I'm trying on the iPhone, as the camera is unavailable on the simulator.
    Here is the code I'm using:
    // In my main code, to initialise the picker
    UIImagePickerController *picker;
    // Check if camera is available
    if ( ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] )
    UIAlertView *alertView = [[UIAlertView alloc]
    initWithTitle:@"Can't access camera" message:@"The camera is unavailable!" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil ];
    [alertView show];
    [alertView release];
    return;
    picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = self;
    [_myView addSubview:picker.view];
    [_myView performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO];
    // The delegate methods
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
    NSLog( @"Image dimensions: %fx%f", image.size.width, image.size.height );
    // Remove the picker interface and release the picker object.
    [picker.view removeFromSuperview];
    [picker release];
    - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    // Remove the picker interface and release the picker object.
    [picker.view removeFromSuperview];
    [picker release];
    }

  • Image with foreign characters in name won't display

    I have an image on my drive whose name has foreign characters ("c�pia de frente.jpg"). To display the image my JSP reads the image name from the database and generates the following html:
    <img src="../pictures/c�pia de frente.jpg">The page then displays a broken image icon for this image. Images in the same list which do not have foreign chars get displayed accurately. When I choose "show image.." in my browser I see that the image name has been rewritten into the following: c%C3%B3pia%20de%20frente.jpg. The rewriting that will display the image is instead c%F3pia%20de%20frente.jpg. I found the correct rewriting on another of my JSP where the image with the foreign chars actually gets displayed correctly although the code to generate the html is the same on both pages and looks something like this (simplified):
    <logic:iterate id="listelement" name="list" property="rows" scope="request" type="org.apache.commons.beanutils.DynaBean">
    <%         
    out.write("<img src=\"../pictures/"+listelement.get("name").toString()+"\">");
                             %>  <br>                     
                            </logic:iterate> Every image that doesn't have foreign chars in its name gets displayed accurately but images with foreign chars in their names won't display. What am I doing wrong?
    Thanks
    Niklas

    Thanks, but it doesn't seem necessary to replace foreign characters. It works without replacing in one place but not in another which is confusing. I think it is something with the enconding but can't see what the difference is between the working and non-working code. In both pages I have put <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">I'd greatly appreciate any more suggestions to solve this problem.

  • Is it possible to tell me how i can make program in labview that take pixels of black and withe image and give coordinate of black or white pixels back to me.

    hello everybody
    is it possible to tell me how i can make program in labview that take pixels of black and withe image and give coordinate of black or white pixels back to me.
    Solved!
    Go to Solution.

    Here's a slightly simpler version.
    (Depending how you want to process the output, you might not need to traspose and/or reverse. Boolean to 0,1 works directly on the 2D array if needed )
    amkamyab wrote:
    it is good. i could enter 1bit image in and show it in array. now i want to take pixels coordinates. i meen i want to have (x,y) of each pixel to send it pixel coordinate to another program i wrote for steppers motor.
    Can you be a bit more specific on how the output is supposed to look like? Initially you wrote "black or white", and since all pixels are either black or white, do you want to send all pixels? In what format? In what order? Please clarify?
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    BW-Pix.png ‏8 KB

  • How can I get to read the pixels in an image?

    Please see details of my code below. What I am doing is trying to obtain the pixels for an image. there is an initial image of a certain size, which is then split into smaller portions.
    The problem I'm getting is that pixels can not be read past the middle of the original image. I hope I have explained this so it can be understood. I have included the class that I am working on
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package MandelbrotConstruction.compression;
    import java.awt.*;
    import java.awt.color.ColorSpace;
    import java.awt.geom.AffineTransform;
    import java.awt.image.*;
    import java.io.*;
    import java.util.ArrayList;
    import javax.imageio.ImageIO;
    import javax.swing.JPanel;
    * @author Charlene Hunter
    public class DisplayImg extends JPanel {
        private static BufferedImage image;
        private static ArrayList<Range> rangeLot;
        private static ArrayList<Domain> domainLot;
        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            int w = MainFrame.getJPanel1().getWidth();
            int h = MainFrame.getJPanel1().getHeight();
            Graphics2D g2 = (Graphics2D) g;
            File img = MainFrame.getImgFile();
            image = null;
            if (img != null) {
                try {
                    image = ImageIO.read(img);
                    //filter the image with a grayscale
                    ColorConvertOp grayOp = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
                    image = grayOp.filter(image, null);
                    //scale image to the size of the panel
                    AffineTransform at = new AffineTransform();
                    at.scale(256.0 / image.getWidth(), 256.0 / image.getHeight());
                    AffineTransformOp resizeOp = new AffineTransformOp(at, null);
                    image = resizeOp.filter(image, null);
                    ArrayList<Range> r = createRanges(image, 3);
                    ArrayList<Domain> d = createDomains(image);
                    int i = 0;
                    for (Domain dom : d) {
                        System.err.println("this is " + i);
                        System.out.println(dom.getPixels());
                        i++;
                    CompareClass comparer = new CompareClass(r, d);
                } catch (IOException e) {
                    System.err.println("IOException");
            g2.drawImage(image, null, 0, 0);
        public static ArrayList<Range> createRanges(BufferedImage bi, int divisions) {
            int w = bi.getWidth();
            int h = bi.getHeight();
            rangeLot = new ArrayList<Range>();
            int k = (int) Math.pow(2, divisions);
            for (int x = 0; x < w; x = x + (w / k)) {
                for (int y = 0; y < h; y = y + (h / k)) {
                    BufferedImage range = bi.getSubimage(x, y, w / k, h / k);
                    double[] pix = range.getRaster().getPixels(x, y, range.getWidth(), range.getHeight(), (double[]) null);
                    Range r = new Range(x, y, range, pix);
                    rangeLot.add(r);
            return rangeLot;
        public static ArrayList<Domain> createDomains(BufferedImage bi) {
            int w = bi.getWidth();
            int h = bi.getHeight();
            domainLot = new ArrayList<Domain>();
            int step = 4;
            for (int x = 0; x < w - step; x = x + step) {
                for (int y = 0; y < h - step; y = y + step) {
                    BufferedImage domain = bi.getSubimage(x, y, 2 * step, 2 * step);
                    double[] pix = domain.getRaster().getPixels(x, y, domain.getWidth(), domain.getHeight(), (double[]) null);
                    Domain d = new Domain(x, y, domain, pix);
                    domainLot.add(d);
            return domainLot;
    }If what I have included is not sufficient, please let me know. the problem is only arising when the pixels are being obtained for the subimage
    Thanks

    Hi, the error message I am getting is (i'm printing out the x,y values and width and height so that I can see what going on) the whole image is 512x512, and I am grabbing pixels for squares of 64x64, but when it gets to 256 it throws an exception. I don'd understand why
    (x: 0, y: 0)
    width: 64, height: 64
    done!
    (x: 0, y: 64)
    width: 64, height: 64
    done!
    (x: 0, y: 128)
    width: 64, height: 64
    done!
    (x: 0, y: 192)
    width: 64, height: 64
    done!
    (x: 0, y: 256)
    width: 64, height: 64
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
            at java.awt.image.ComponentSampleModel.getSampleDouble(ComponentSampleModel.java:807)
            at java.awt.image.SampleModel.getPixels(SampleModel.java:823)
            at java.awt.image.Raster.getPixels(Raster.java:1613)
            at MandelbrotConstruction.compression.DisplayImg.createRanges(DisplayImg.java:83)
            at MandelbrotConstruction.compression.DisplayImg.paintComponent(DisplayImg.java:51)
            at javax.swing.JComponent.paint(JComponent.java:1006)
            at javax.swing.JComponent.paintChildren(JComponent.java:843)
            at javax.swing.JComponent.paint(JComponent.java:1015)
            at javax.swing.JComponent.paintChildren(JComponent.java:843)
            at javax.swing.JComponent.paint(JComponent.java:1015)
            at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
            at javax.swing.JComponent.paintChildren(JComponent.java:843)
            at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4979)
            at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4925)
            at javax.swing.JComponent.paint(JComponent.java:996)
            at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
            at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
            at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
            at java.awt.Container.paint(Container.java:1709)
            at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
            at sun.awt.RepaintArea.paint(RepaintArea.java:224)
            at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
            at java.awt.Component.dispatchEventImpl(Component.java:4060)
            at java.awt.Container.dispatchEventImpl(Container.java:2024)
            at java.awt.Window.dispatchEventImpl(Window.java:1791)
            at java.awt.Component.dispatchEvent(Component.java:3819)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

  • I have a video in excellent quality (1280x720 23,976 fps) I burn the dvd in encore cs6 with hd menu and I get pixelated.   I've done transcoding but It downgrade to 480   I need urgent help.

    I have a video in excellent quality (1280x720 23,976 fps) I burn the dvd in encore cs6 with hd menu and I get pixelated.   I've done transcoding but It downgrade to 480   I need urgent help.

    Hi,
    first, sorry if my english sucks jajaa i speach spanish, havent practice my english for a while.
    first i edited my video in premier cc
    sequence 1280X720, 59,94 fps
    48000hz - stereo
    the i linked it with dynamik link to after, make some color correction, etc etc etc
    i renderd in quicktime animation
    my video looks fine in my computer, but when i send my .mov video to encore (cs6) in a HD MENU and standard menú, the image sucks.
    i have done the transcoding in encore, but i doesnt work either. i dont know what else to do.

  • High quality images in indesign CS6 get pixelated

    I have been using indesign CS6 for a while now. Recently, when I place some images into a document, they are pixelated. They are high quality images with a high resolution. Even when I shrink it down considerably to fit in the document, it still gets pixelated. I have "view High Quality" checked & the image prints pixelated as well. When I preview the image, it looks fine. Any ideas?

    Can you post a screen shot of the image placed on ID to have an idea of what you're looking at? If possible can you share a sample image via dropbox?

  • Pixelated images (with High Quality Display turned on)

    Here's my problem: The images look sharp on the internet, but when I download them, place them in Indesign and print them, the look pixelated!
    Take this one for example: http://media.smashingmagazine.com/images/typefaces/productus.gif
    It's resolution is 72 ppi. But when I place it onto the Indesign A4 page (or Letter format for that matter) it occupys almost entire width of the page.
    Why is it so? Why is it so big by default without enlarging it? It's kinda logic that a small 72 ppi image stretched across the whole page will appear blurry when printed on 300 dpi printer.
    So how can I set the indesign page to 300 ppi/dpi so images with lower restion will appear smaller when placed on the page and - will be printed sharp?

    mike.n03 wrote:
    Where can you specify this preference?
    And you mean there's a script for InDesign? Wow, it would be cool to get it. So far I solved that problem by recording an Action in Photoshop and than apply it to all the images using Batch command.
    Preference is down at the bottom of the File Handling section ...  Check the bos to preserve dimensions and a the relinked file will be scaled back to the same size in ID. Uncheck, and the scale percentage will be preserved.
    Almost anything is scriptable in ID (but I don't write them). I recall a script that was posted a year or two ago that would allow you to select an image and type a desired effective resolution into a dialog. The image would get scaled to reach that effective ppi. Your batch action in Photoshop is fine, and useful if you want to palce everything at 100%, but it isn't required to change the resolution in Photshop to achieve what you want. Scaling in ID is exactly the same thing as changing the resolution without resampling in Photoshop. No pixels are added, removed or altered -- only their dispalyed size is changed. If you want a script to set all images to 300 ppi effective resolution, you should probably pay a visit to the scripting forum.

  • PCI 1422. Grab an image with 1 pixel height.

    Hello.
    I'm trying to configure my PCI-1422 board to accquire an image from my custom made line scan camera.
    My camera sends a frame of 1 pixel height (24000px width) to the board. Every 1.9msec (so i should get approx. 526 fps).
    The framegrabber recieves 3 signals: data, pixel clock (12.5MHz) and frame valid signal (i connected it to Enable A pin of PCI-1422).
    The issue is that MAX says to me, that the total fps is 263.
    When I try to get image data in my application (c++) i may recieve even less - only 1/4 of total frames.
    Could you tell me how to configure *.icd file to be able to get 526 (24000x1px, 8bit) fps with my camera?
    Is there any problem with my c++ code?
    You may see my application and *icd file attached.
    Attachments:
    llsequence.h ‏1 KB
    llsequence.c ‏13 KB
    MSU_100_A.zip ‏1 KB

    Alvern,
    How many clock counts rae you waiting between frames?  Have you tried decrasing the ROI further?  You got it set 8 pixels shorter than the actual ccd, have you tried setting it 100 pixels shorter?  What about 1000?  I imagine you're interested in preserving as many pixels as possible, but try testing acquisition with shorter ROI's just to see if a sufficiently short ROI will allow you to acquire at the full frame rate.  
    If adjusting the ROI in addition to enabling fast rearm and Non Continuous Line Enable does not allow you to acquire at the desired frame rate are you able to decrease the frame rate?  If so, what frame rates have you been able to acquire at without losing frames?
    Also, though you are interested in continuous acquisition, have you tried snaping a finite sequence of images?  Try snapping a finite number of images and storing them on the frame grabber to see if you are able to acquire at the full frame rate.
    I suspect altering either the ROI, the frame rate, or the acqusition mode and buffering location will allow you to acquire without missing frames.  Would you be able to test these and post your results?
    David A
    National Instruments
    FlexRIO Product Support Engineer

  • Convert colour images to grayscale images & get pixel data from them

    Is the code below correct to convert colour images to grayscale images in Java?
    public void convertToGrayscale (String sourceName,String destName) throws Exception {
    JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(new FileInputStream(sourceName));
    JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(new FileOutputStream(destName));
    BufferedImage sourceImg=decoder.decodeAsBufferedImage();
    BufferedImageOp op =new ColorConvertOp(
              ColorSpace.getInstance(ColorSpace.CS_GRAY),null);
         BufferedImage destImg = op.filter(sourceImg,null);
    encoder.encode(destImg);
    decoder = null;
    encoder = null;
    When I get grayscale images from the code below, I would like to access the pixels of those images. So I tried to do:
    byte[] dd=((DataBufferByte)mImage.getRaster().getDataBuffer()).getData();
    BUT the data result array is not 0-255. Could anyone suggest how to obtain pixel data from grayscale images?
    In case that my code shown is not correct or suitable, please give your advice. What I would like to do are in the steps as follows:
    1 change 100*70 jpeg-images to 100*70 grayscale images.
    2 create two dimensional array of pixel data (example [100][70]) from converted images. The number in the array should be between 0-255, right??? And 0 refers to black colour and 255 refers to white colour???
    I am confused about grayscale images. Please help.
    Thank you so much

    I am not sure i understand what is the problem exactly.
    Structure of DataBuffer is described by SampleModel used by same Raster
    object. E.g. it might be 1 byte per xipex or 4 bytes per pixel.
    In your example convertToGrayscale saves images to file as JPEG and
    it seems you later read it back. It is possible what image you read back
    is not greyscale but ARGB and data buffer has different format.
    Technically, if you just need level of grey you may simply
    call getRGB on your output image. Grey is uniform mix of R, G and B.
    Also, instead of ColorConverOp you may dimply create output image of
    grayscale type and draw your color input image with drawImage().
    If none of these helps please try to provide more details.

  • How to get pixel positions with IMAQ Vision for CVI

    Hi,
    I am trying to connect a callback to an IMAQ window that contains an image that I generated. The purpose simply to get the coordinates of the mouse for every left_click event on that IMAQ window.
    How can I do this by using the function
    imaqGetPixelAddress(); and using a callback associated to the IMAQ window.
    Is there an example code to help doing this in LW-CVI?
    Many thanks,
    JHH

    Hello,
    You can do this by calling the imaqGetLastEvent() function with IMAQ_CLICK_EVENT as the tool parameter.
    Hope this helps!
    Yusuf C.
    Applications Engineering
    National Instruments

  • In bridge i select a jpg image with cntrl r to open in camera raw but get "camera raw not avail"

    In bridge i select a jpg image with cntrl r to open in camera raw but get "camera raw not available"  camera raw editing requires that a qualifying product has been launched at least once to enable this feature.  I can open nef. in camera raw with no problem.

    Hm, what I suggested might actually be a possibility then...
    Close whatever version you have open first...
    I think Adobe installs shortcuts for both 32 and 64 bit Photoshop in the start menu.
    If you can't find the 32 bit Start menu entry, look for the 32 executable here (changing the CS version number to whatever yours is):
    C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Photoshop.exe
    -Noel

  • Can't get photoshop elements 12 to print multiple copies of an image with one print job? what to do?

    Can't get photoshop elements 12 to print multiple copies of an image with one print job

    How do I do that? I'm the only user on the laptop - I kind of assumed I already was running the install as the admin.

  • We are trying to transfer files from PS Elements 13 to our web builder.  We are getting a '?' in the top left hand corners of some of the image boxes. It seems that we are unable to transfer images with this ? on the image.  We have spent a long time taki

    We are trying to 'reconnect' files.  we seem incapable to do so, for some reason.  Try as we might, we aren't able to do it.  can anyone help?

    Please see other thread
    Re: We are trying to transfer files from PS Elements 13 to our web builder.  We are getting a '?' in the top left hand corners of some of the image boxes. It seems that we are unable to transfer images with this ? on the image.  We have spent a long time

Maybe you are looking for