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

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.

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • How can i convert an image into gif file as jpeg by using com.sun.image.*

    please help me to convert an image into gif format. i have used sun's impl com.sun.image.code.jpeg package to convert a buffered image into a jpeg file. is there any implementatioln available from sun to handle gif files.

    Many. Try for instance google with 'java image encoders'. Go to the URL http://www.google.com/search?q=java+image+encoders and be amazed of the wonders of modern web search tools.

  • Can I convert 3D image to an array of pixels in LabVIEW?

    Hi all;
    I am still new with labview. I has 1 question, can I convert 3D image to an array of pixels using labview?
    Most of the examples I found they only convert 2D image. Hope anyone can give me some hint.
    Thank You

    look at this thread.
    It has links to other threads where the 3D graphs were used.
    You should also search for "gif reader" to find threads where images are read from gif files.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • 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

  • Converting an Image into a Button

    Hello all,
    I'm a very new user to Adobe Flash, and am trying to figure out some of the small things. I was wondering if anyone could help me out with how to convert an image into a button (with a URL).
    Thank you!
    Dave

    Let's say you created a button symbol. The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So you drag a copy of it out to the stage from the library, and while it's still selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"
    In AS3, to make a button work with code, you need to add an event listener and event hamdler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:
    function btn1Click(evt:MouseEvent):void {
       var url:String = "http://www.awebsite.com/awebpage.html";
       var req:URLRequest = new URLRequest(url);
       navigateToURL(req);

  • Converting tiff images into jpeg

    I would like to convert tiff images into jpegs with iphoto. I dont want to duplicate all my photos and then have to delete one by one!
    How do I do this?

    Welcome to the Apple Discussions. The short answer is that you cannot. You will have to export the files via the File->Export->File Export menu option, selecting jpeg as the format and checking the box to include the keywords and comments, and maximum size. Then import the jpgs and delete the tiffs.
    You can get all of the tiff files together by doing a search for .tif. Then do a Select All (Command-A) and go to the export menu. Export all to a folder on the desktop. Import the new jpgs into iPhoto.
    To get rid of the tiffs once the jpgs are imported do another search for the tifs and select all again. Then type Command+Delete. That moves the tiff photos to iPhoto's Trash bin. Then empty the bin.
    If you have multiple files with the same file name you'll have to do some renaming before the export. You can batch rename them using the option Title to Date/Time or just date alone. I use the date taken as the file name as that gives me excellent chronological sorting and searching by filename for dates.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Convert Jpg images into patterns (.pat)

    Is it possible to Batch convert Jpg images into .pat files? I am familiar with the define pattern function but what I really need is to convert many jpg's.
    Thanks

    Use edit Define pattern on the image to define a Photoshop pattern. Then use the preset manager to save the pattern as a *.pat file.....
    To batch this you may need to use a Photoshop Script to name the patterns a action define pattern step would have a hard code pattern name. Changing that step to a script could retrieve the document name and set the pattern name the same as the jpeg name.  You could define many patterns that way then use the preset manager select all the defined patterns and save a single *.pat file with that set of patterns.

  • 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

  • How can i convert CR2 images into jpg format, without iPhoto?

    i just import a lot of images with the format .CR2 to mac through "Image capture" is there an app to convert the frmat into .jpg, app like image capture or something like that?

    If Canons software doesn't work...?
    Try Snap Converter, File Juicer or Contenta Converter

  • How to convert jpeg image  into vector

    I have jpeg  image which contains line and circle. i want  to convert this image as a vector  and  i need to export  into DXF file format.
    In my illustrator i am not able to find live Trace option. how to enable live trace option.
    can anyone  help me to convert this,because  i am new to Adobe Illustrator.
    Thanks  in Advance.

    If you do want to use the image trace option here is how you do it:
    If you have nothing selected your contextual menu should look something like this:
    If you have your image selected your contextual menu will look like this.
    You can use the image trace from that button. to find it through the menu go here:

  • I want to convert a String into an array of bytes

    I am working with telnet programming with java, where I want to convert login name and password of an online user in 'String' format to 'Bytes', plz help me. Which Input or Output Stream I can use

    Assuming you've got the username / password into a String object, you can convert it to a byte[] array using this method.
    String.getBytes();
    Look at the String API
    http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html
    Hope that helps.

  • How to convert jpeg images into video file of any ext using JMF

    I want to convert the Jpeg files into video clip with the help of JMF
    any one can help me?
    Plz reply me at [email protected]
    or [email protected]

    I'm not sure of his/her reasoning behind this, but I have yet to find a way to record video with mmapi on j2me. So with that restriction, I can see how one could make it so that it just records a lot of jpegs, and then makes it a movie.
    I would be interested finding a workaround for this too. Either if someone would explain how to record video with mmapi or how to make recorded images into a video. Thanks!

  • How to Convert Bitmap Images into WPF XAML files

    I am tasked with converting about twenty bitmap images into a workable XAML file complete with all of the path statements, line segments, arc segments, etc. Is there a tool out there that take the bitmap image and create an entirely new XAML file?
    Thanks,
    Barton

    Hi,
    maybe:
    http://stevenhollidge.blogspot.de/2012/05/converting-images-to-paths.html
    http://stackoverflow.com/questions/129972/convert-an-image-to-xaml
    http://stackoverflow.com/questions/15082716/can-we-convert-an-image-to-xaml-using-expression-blend
    this is not a trivial task [and maybe beyond the scope of this forum]. If you had some vector image like svg images there might be a control out to use, but with raster images, I dont know of any control or code to use; I *think*, you will have to vectorize
    the image content yourself, which isn't that easy...
    So, is Background and Foreground easily distinguishable? Do shapes overlap? ...
    If there are only some shapes in the image and BG and FG can be separated easily then you could "scan" the image by some chaincode like operation to get the contours/contour vectors and then decide what to do. If there are patterns in BG or FG
    things will become more difficult, you then will have to perform more math-to-image operations and a vector-representation while reading/scanning the image might not be enough (keywords are computer vision, pattern recognition [with multi-linear-forms] etc).
    Maybe an existing computer vision [-able] component loke opencv can help a lot...
    Edit: I just did a google lookup and found eg this:
    http://www.cs.ucla.edu/~dt/theses/vasilescu-thesis.pdf
    I havent read it so far, so I cannot say, if its what you need, but title and a quick view into looks promising/interesting.
    Regards,
      Thorsten

Maybe you are looking for

  • 非超级管理员不能查看付款草稿?

    HI,各位:            请教一个问题,在使用非超级管理员时不能查看付款草稿,原先该用户被设置为超级管理员了,我还以为非超级管理员也可以查看了.但后来反复测试还是不行哦,有没有人知道的?谢谢. Question for Outgoing Payment Drafts Report

  • Dynamic file name for report export to csv

    If "Enable CSV output" = "YES" for a report region titled "Invoices", the default file name is "Invoices.csv". If I have a parameter, Pn_MONTH, for the month (e.g. Jan 2010, Feb 2010, etc.) and the report only shows data for that month, I would like

  • Why does my notebook keep on quitting

    When i try to open my notebook, it quits automaticlly.

  • Doubt regarding report on cube

    Hi Experts I am facing a problem in Report . Actually when ever i try to run my query i get fiscal year embedded with its variant for eg fiscal year is 10 and its variant is x output i get is x\10 but what actully want is 10. i am not getting what we

  • Calling Winrar.exe from Execution Process Task by Passing Arguments

    Is any body having knowledge please let me know how to pass the arguments to winrar .exe to create a zip file from the Execution Process Task  in SSIS