Unable to read images into an array

Hi there,
I hope that someone will be able to help me. I have set up a program that will set the loop count to the number of images in the folder (orange input). With each execution of the loop, I would like an image to be read from file (using IMAQ ReadFile) and then stored to an array (purple output). Please find the screenshot attached with a snip of the code in question and the error that results from executing the vi (highlights the IMAQ ReadFile vi).
I do have 5 images with the name: image0.png - image4.png in the folder directory specified by "Image Read File Path" and made sure that the path appends the actual name to the file path.
I am fairly new to Labview programming (I have searched for a solution and troubleshooted as much as I can) and I hope I have provided enough information.
Kind regards,
Richard
Attachments:
Program.PNG ‏19 KB

I wonder if the extra backslash is messing up the path. "Build Path" handles the file seperator. Right click on the final path and select Probe, or create and indicator to see the path.
Attachments:
Untitled.png ‏3 KB

Similar Messages

  • Converting image into byte array

    Hi all,
    How to convert an integer array image into byte array ?
    here i have a image like this :
    private static int pixelArray[] = {
    0xff000000, 0xff000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0xff000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
    From this one i create image like this one :
    Image image = Image.createRGBImage(pixelArray, width, height, true);
    Now i want to convert that pixelArray into byte array ? how to do this
    additionally i want to send this byte array to servlet .
    thanks in advance.

    Hi,
    If you want to convert your int array to a byte array you should
    split each integer into 4 bytes to avoid losing information. You can
    rebuild your integer array later if you need to. I think this code
    will work (i havent tested it):
    byte[] pixel= new byte[pixelArray.length<< 2];
    for (int i= pixelArray.length- 1; i>= 0; i--) {
      int aux= i<< 2;  // i* 4 = i<< 2
      pixel[aux]=    (byte) (pixelArray>> 32);
    pixel[aux+ 1]= (byte) (pixelArray[i]>>> 16);
    pixel[aux+ 2]= (byte) (pixelArray[i]>>> 8);
    pixel[aux+ 3]= (byte) pixelArray[i];
    Greets.

  • Grabbing Pixels from an image into an array

    Hi,
    I am new to the image processing using java. I want to get the pixel values of an image and store it into an text file. Can anyone help me with this?
    This is what i've done yet? Is the values present in the text field the correct values of the pixels of the image.
    import java.awt.*;
    import java.awt.image.*;
    import java.applet.*;
    import java.util.*;
    public class grabber extends Applet {
    private TextField tf;
    private TextArea ta;
    private Label status;
    private Canvas drawarea;
    private Image img=null;
    int ppmline=0;
    public void init() {
         setLayout(new GridLayout(1,2));
         Panel left=new Panel();
    left.setLayout(new BorderLayout());
    Panel topleft = new Panel();
    topleft.setLayout(new GridLayout(1, 4));
    topleft.add(tf=new TextField());
         Panel buttonsP = new Panel();
    buttonsP.add(new Button("Load GIF"));
         buttonsP.add(new Button("PPM Output"));
         topleft.add(buttonsP);
    left.add("North", topleft);
    left.add("Center", drawarea=new Canvas());
         left.add("South", status=new Label());
         add(left);               // left side of the applet.
         add(ta=new TextArea());          // right side.
         status.setText("See GIF files below.");
    public void paint(Graphics appletg) {
         Graphics g=drawarea.getGraphics();
         if (img != null) {
              g.drawImage(img, 0, 0, this);
              g.dispose();
    public boolean action(Event evt, Object arg) {
         String s=(String) arg;
         if(s.equals("Load GIF")) {
              img=getImage(getCodeBase(), tf.getText());
              repaint();
         else if (s.equals("PPM Output")) getPixs();
    return true;
    void getPixs() {
         int w=30, h=30;
         // PPM output starts.
         ta.setText("P3\n");
         ta.appendText(Integer.toString(w) + " " + Integer.toString(h) + "\n");
         ta.appendText("255\n");
         handlepixels(img, 0, 0, w, h);
    public void handlesinglepixel(int x, int y, int pixel) {
         // pixel is in RGB model. It is a 4-byte long integer.
         // It is converted into the string representation of PPM pixels.
         // ie. Hex 0x00102030 becomes "16 32 48"
         String s= Integer.toString((pixel & 0x00FF0000) >> 16) + " "
              + Integer.toString((pixel & 0x0000FF00) >> 8) + " "
              + Integer.toString(pixel & 0x000000FF) + " ";
    // If we use PPM RAW format, then we have to use ascii characters instead.
    //     char c[]= {(char) ((pixel & 0x00FF0000) >> 16),
    //          (char) ((pixel & 0x0000FF00) >> 8) ,
    //          (char) (pixel & 0x000000FF) };
    //     String s=new String(c);
         if (ppmline++>=3) {                // comment out if you use RAW format.
              ta.appendText(s + "\n");      // comment out if you use RAW format.
              ppmline=0;               // comment out if you use RAW format.
         } else                          // comment out if you use RAW format.
              ta.appendText(s);
    public void handlepixels(Image img, int x, int y, int w, int h) {
    int[] pixels = new int[w * h];
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    try {
    pg.grabPixels();
    } catch (InterruptedException e) {
    System.err.println("interrupted waiting for pixels!");
    return;
    if ((pg.status() & ImageObserver.ABORT) != 0) {
    System.err.println("image fetch aborted or errored");
    return;
    for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
    handlesinglepixel(x+i, y+j, pixels[j * w + i]);

    im not at home or id post some source code but first off
    if your going to write a file from a applet your going to
    have to get by permisions.
    so you should probably do this with a application
    it would be alot easier
    use toolkit.getdefaulttoolkit() to get the image then
    use the pixel graber class to read it into a array
    of the type you want string or char
    then just write it into a file each element of the array
    and when you want to read it just read it in with file reader
    you could probaly do a test run just write in each value as
    a string and put a comma between each value then use
    stringtokenizer to read it back in its less efficient but
    for a test run it would make things clearer
    sorry if its not much help

  • ORA-29400: data cartridge error/IMG-00703: unable to read image data error

    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    ORA-29400: data cartridge error
    IMG-00703: unable to read image data
    ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 75
    ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 65
    ORA-06512: at "ORDSYS.ORDIMG_PKG", line 37
    ORA-06512: at "ORDSYS.ORDIMAGE", line 927
    is raised when the following trigger is processing certain JPGs (example). Other JPGs are handled as expected:
    create or replace trigger photo_size_trg
    before insert or update on photos
    for each row
    declare
      photo_width integer;
    begin
      -- Check to see if the new photograph is different from the old one...      --
      if dbms_lob.compare(:old.photo, :new.photo) != 0
      then
        -- ...if so, check to see if it's wider than the desired 250 pixel        --
        -- maximum...                                                             --
        photo_width := to_number(ordImage.getMetadata(:new.photo)(1).extract('/ordImageAttributes/width/text()').getStringVal());
        if photo_width > 250
        then
          -- ...and if so, apply an image transform that will resize to the photo --
          -- to a maximum of 250 pixels wide, keeping the original aspect ratio.  --
          -- There doesn't seem to be an elegant way of specifying a constraint   --
          -- in one dimension like this, so the height is specifed as a large     --
          -- enough value to cover all practical contingencies.                   --
          ordImage.process(:new.photo, 'maxScale=250 10000');
        end if;
      end if;
    end;Any thoughts/suggestions?

    hi,
    I am getting following error,kindly help me out to rectify this ..
    thank you
    ORA-29400: data cartridge error
    ORA-00600: internal error code, arguments: [kokbCollTerminate], [13], [], [], [], [], [], []

  • Converting an image into numeric array?

    I want to sum all the pixel values in a image. I was thinking of using the Add Array Elements VI. Is their an easy way to convert an U8 or an I16 bit image into a numeric array? Thank you in advance.

    Is this a BW image? (If the image is paletted or color, a summing operation is poorly defined! )
    Just convert your image data to a 2D boolean array using unflatten pixmap, then feed the 1bit pixmap to "boolean to 0..1" followed by the SUM operation (in case it overflows, you might want to convert it to a better representation before summing, e.g. DBL. "boolean to 0,1" generates I16).
    Message Edited by altenbach on 06-01-2005 02:44 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SumImage.png ‏2 KB

  • Reading files into an array

    so im new to this and having problems.
    we have to read a .txt file into an array so when a user types a word in a text box it will search the file and reutrn found if the word is there and not found it the word is not there. but it is not reading the text file here is the code so far
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Checker
    // Declares Values in the array
         static String [] anArray = new String[1000];
         // declares variables needed in code later
         int i;
         String s;
         static int count = 0;
         static String b;
         static JTextArea j = new JTextArea();
         public void readFile() throws IOException{
         File inFile = new File("words.txt");
         FileReader fileReader = new FileReader(inFile);
    BufferedReader bufReader = new BufferedReader(fileReader);
    while (true){
    b = bufReader.readLine();
    anArray[count] = b;
    count++;
    if(b==null) throw new EOFException("Hello, end of file reached");
    j.append(b);
    j.append("\n");
         // public static void main(String args[]){
         // File outFile = new File("words.txt");
         //FileOutputStream outFileStream = new FileOutputStream(outFile);
         // PrintWriter outStream = new PrintWriter(outFileStream);
         // outStream.println("help");
    // File inFile = new File("words.txt");
    // FileReader fileReader = new FileReader(inFile);
    // BufferedReader bufReader = new BufferedReader(fileReader);
    /* while (true){
    b = bufReader.readLine();
    anArray[count] = b;
    count++;
    if(b==null) throw new EOFException("Hello, end of file reached");
    j.append(b);
    j.append("\n");
    public String checkword(String Word ) {
    // Tries the code, runs through until an exception is found.
    try {
    for ( i = 0; i < anArray.length; i++)
    if (Word.equals(anArray))
    // If exception is found, throws a new exception
    if (Word.equals(anArray[i])) throw new Exception(); // end if
    } // end if
    } // end for
    } // end try
    catch (Exception ae ) {
    // if the word is found return a message found and its position in array.
    return "Found, at position "+i;
    }// end catch
    // if its not in the array return a not found message
    return "Not found";
         } // end
    } // end
    and the gui class :
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class CountDown extends JFrame implements ActionListener
    // Defines the GUI components
    private JTextField Word = new JTextField(9);
    private JButton Guess = new JButton("Enter String");
         private JLabel Message = new JLabel("not found");
         // Creates a new instance of the Checker class.
    Checker ch = new Checker();
    public CountDown() // constructor
    setTitle("Count Down");
    setSize(300,200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
    Container c = getContentPane();
    c.setBackground(Color.white);
    c.setLayout(new GridLayout(3,1));
    // Add the components
    c.add(Word);
    c.add(Guess);
    c.add(Message);
    c.add(ch.j);
    // Add action Listener for Button to work
    Guess.addActionListener(this);
    pack();
    setContentPane(c);
    public void actionPerformed(ActionEvent e) {
    // When the button is pressed do this code
    if(e.getSource() == Guess)
    // Looks in the checker class to compare the word user enters, to the words in the array.
    // Returns a message if the word exists with its position in the list or
    // Returns a message if the word does not exisit.
    Message.setText( ch.checkword(Word.getText()));
    public class CountDownA
    public void main(String[] args)
    CountDown Game = new CountDown();
    any help is appriciated asap

    Yuck! I echo jverd's sentiment. Please only post the specific pieces of code that you are having trouble with, and use the forum 'code' tags.
    But to answer your question, I don't see where you're calling the readFile() method from. If you're not calling readFile, that might explain why nothing is being read.
    As for the design of the readFile method, another 'yuck'. heh Don't use exceptions to break out of a loop. If you MUST break out of a loop, use break. But a loop like this doesn't need break. Try something like this:while( (b = bufReader.readLine()) != null)
         anArray[count++] = b;
         j.append(b+"\n");
    }Also, in stead of creating an array of some arbitrary fixed length, I recommend using a collection class such as ArrayList.
    In stead of this:static String [] anArray = new String[1000];
    anArray[count++] = b;it would be better to use something like this:static ArrayList<String> arrayList = new ArrayList<String>();
    arrayList.add(b);

  • Conversion of image into byte array

    I have a problem in converting .png image into bytestream, if anyone can help in this pls do so.....

    Hi,
    To convert an Image to bytes you can use the Image.getRGB() method.
    http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Image.html#getRGB(int[], int, int, int, int, int, int)
    -Henrik

  • How can I convert a bitmap image into an array in LabVIEW 6.0.2, then to a spreadsheet for further analysis without NI-IMAQ or Vision?

    I do not have NI-IMAQ or NI Vision.
    I acquired the image using a picolo board then just saved it as a bitmap file.

    You want to convert it to an array of what? Of numbers? Of LabVIEW colors?
    The "Read BMP File.vi" VI outputs a 1-D array of the pixels, but I suspect it is not exactly in the format that you need. I am NOT sure, but I think that each group of 3 elements of that 1-D array (which is inside the cluster "image data" that the VI outputs) represents the red, green and blue levels of a single pixel (but it may be hue, saturation and lum.). Also, since it is a 1-D array, you would have to divide it by the width (which is also included in the "image data" cluster) to get some sort of 2-D array of data.
    You can find the "Read BMP File.vi" VI in the functions palete> "Graphics & sound">"Graphics Formats".

  • How to change the image into byte and byte array into image

    now i am developing one project. i want change the image into byte array and then byte array into image.

    FileInputStream is = new FileInputStream(file);
    byte[] result = IOUtils.toByteArray(is);
    with apache common IO lib

  • Inserting Image into a BLOB column in Oracle9i

    Hi,
    I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
    Same thing is true for CLOB in 9i.
    Would you please try with this code?
    TABLE
    Create table x
    (Id number,
    Name CLOB,
    Pict BLOB);
    WHEN-BUTTON-PRESSED trigge
    declare
         x varchar2(265);
    begin
         x := get_file_name;
         read_image_file (x, 'GIF', 'picture.pict');
    end;
    Take care,
    Tarek

    Forms 9i and Oracle 9i work fine together for this case.

  • Import bitmap into an array

    I want to import a 24-bit bitmap image into an array so I can loop through the array and perform calculations based on the color of the pixels etc.
    Can any one advise me of an easy way to do this in Java?
    Thanks

    I want to import a 24-bit bitmap image into an array so I can loop through the array and perform calculations based on the color of the pixels etc. java.&#8203;awt.&#8203;image.&#8203;BufferedImage:
    public int[] getRGB(int arg0, int arg1, int arg2, int arg3, int[] arg4, int arg5, int arg6)
    it works for jpeg and png, dont know about bmp.........
    See this link:
    [http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/BufferedImage.html]

  • Storing an image into SQLite

    I have to sto an image from a link(www.somsite.com/sample.jpg) to the SQLite data base. And  I hav to retrieve the same image and display it into the application. i tried it by coverting the image into byte array and store that byte array to the SQLite as BLOB. but it is not working. Please someone help me to getting out of it.

    Does the image have to be stored in the session? An alternative is to store the path and filename of the image.

  • Webutil - Read Image?

    1.While reading image into image item of my canvas
    if the image size larger then my image item size
    i want it to be scroll both horizontally and vertically.
    Is that possible.?
    2.I want to give zoom in/out functionality to that image item.
    How?
    3.Also i want to restrict the user from select file type
    other than gif,tif,jpg,jpeg,bmp etc...???

    Dear Faheem;
    For ur questions No. 1 & 2 if you open the property palette for the image item you search for the categeory[b] faunctional there is a property called[b] Show palette assign it to YES then if you run ur form you will get a control palette for zooming or moving the image.
    For Quest. 3 I think you have to use it by coding like this code :
    photo_filename := tiff_image_dir||LOWER(:emp.userid)||'.tif';
    ** For example 'photo_filename' might look like:
    ** /usr/staff/photos/jgetty.tif
    ** Now, read in the appropriate image.
    READ_IMAGE_FILE(photo_filename, 'TIFF', 'emp.emp_photo');
    Hope it help
    Regards
    Reda El Mitwally

  • Read part of an array element

    Hello All.
    As indicated in the title, I am trying to read part of an array element.
    What I'm doing is reading values from a LeCroy scope using a "write" than "read" I have returned the read values into an array but the issue is the scope returns a value "1, 52.33E-3"
    I simply want the element to be 52.33 that way I can use that for other calculations.
    For example my array is.
    "1, 34.334E-3"
    "1, 53.343E-3"
    "1, 143.232E-"
    And I want it to be
    34.334
    53.343
    143.232
    Thanks!
    Solved!
    Go to Solution.

    Another option is to use Spreadsheet String to Array and use the comma as the delimiter.  It can actually change your string into an array of numbers.  Then you just index out the number you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Read xml file to array

    I would like to read an xml file to an array before placing it in a document. I have seen people on here do something similar but I just can't get it to work.
    Right now I am having to open the docuement as just a file read it into an array and then pull the elements I want with a regex expression, which is pretty tedious.
    It seems the framework has some pretty nice xml element functions if I could just read the file in an xml format
    Right now I am doing something like this to read the file
    myfile = new File (path to file);
    myfile.open("r");
    myothervariable = myfile.read();
    myfile.close();
    But I am just reading it as simple text. I can't use any of the xml properties or functions on any of this. Does this make sense?
    Thanks in advance for any help

    Do this:
    myfile = new File (path to file);
    myfile.open("r");
    myXML = new XML (myfile.read());
    myfile.close();
    You now have an XML object that you can parse with JavaScript. See the ESTK's JavaScript Tools Guide (in the ESTK's Help menu), the chapter entitled "Integrating XML into JavaScript" (ch. 9 in CS5).
    Peter

Maybe you are looking for

  • How to generate columnar PDM for HANA?

    Hi Folks, I'm quite new to PowerDesigner and have been working on generating a HANA database from MS SQLServer. Currently I've been able to import a source SQLServer system as a Physical Data Model in PowerDesigner. I was then able to generate SQL DD

  • Question on launching popup window..

    Hi, In our application, from an existing page, there is a need to launch a pop up window where the user can view certain values in read-only mode. This window will be launched at the click of a button created through personalization on the main page.

  • CSS list-based navigation bar (Wordpress menu) doesn't render.

    This website is powered by Wordpress with a custom HTML5/CSS3 theme. However, even after various attempts to debug and recode, the navigation menu (based on WP3's built-in menu feature) fails to render in Firefox, where it renders normally in Safari

  • EXC_BAD_ACCESS (SIGBUS) error ONLY with Word and Excel

    Whenever I try to launch Microsoft Word or Excel either from the Dock or from the applications folder, the programs fail to launch and I get this in the report: EXCBADACCESS (SIGBUS). What's odd is that both programs will start if I double click an e

  • Printer Error - Epson 3880 & LR and talking with each other?

    I am trying to use the Epson 3880 with LR; however, I get a printer error every time I try to print. The error shows up in the printer status and is immediate. The printer works fine with iPhoto. It is connected and the Utility is speaking with print