Help me to do this "IMAQ"-2 image file attached

Dear friends
In this i attach my image file in Tif format & jpeg format
Please go through this vi
this vi it will display a image window when u click inside that window a square box will create, where ever u click it will create multiple box. i used imaq windraw function, u can see another image window in the front pannel also.
now my aim is to put a box over that spot with the spot as center and to extract the pixel values of the individual boxes,
now whats happening is when i run this program a image window is opening from the imaq windraw function in that 1ly i can able to put multiple box but that box is displayed in the image display in the front pannel also. but i cant put the box in the image window in the front pannel. if u click the mouse in the image window in the front pannel it will display the 25x25pixel values.
i want both to be done in a same window i want to put a multiple square box and the pixel values i want to extract seperately for the individual boxes. please help me give some ideas how to do this please modify this vi.
thank u
sasi
Attachments:
1.zip ‏279 KB

Sasi,
I am a little confused on what exactly you want to do and why you are using both WinDraw and an Image Display Control to show the image. It sounds like what you want to be able to do are the following 3 things:
1) Display the Image
2) Click on the image and have a rectangle overlay appear on image
3) Get the pixel values from that rectangle into an array
If I am understanding you correctly, then you should only display the image using one of the above display methods and have only a signal case structure in your code that adds the overlay to the image AND extracts the pixel values. I am a little unclear as to why you have decided to only get the pixel values if the user clicks on the Image Display and only draw the rectangle if the user clicks on the WinDraw display.
I have attached an image of a block diagram, which is what I think that you are trying to do. In the block diagram you can see that I have combined everything into one case structure so that whenever a user clicks on the Image Display (no WinDraw) then I add a rectangle overlay to my image and also get the pixel values for that area. If you want to keep track of the pixel values for each rectangle then you could use a shift register and build up a 3-D array with all of this information ... or write the data to file ... or use another method to keep that data for future use.
Regards,
Michael
Applications Engineer
National Instruments

Similar Messages

  • Help me to do this "IMAQ"-1

    Dear friends
    Please go through this vi
    this vi it will display a image window when u click inside that window a square box will create, where ever u click it will create multiple box. i used imaq windraw function, u can see another image window in the front pannel also.
    now my aim is to put a box over that spot with the spot as center and to extract the pixel values of the individual boxes,
    now whats happening is when i run this program a image window is opening from the imaq windraw function in that 1ly i can able to put multiple box but that box is displayed in the image display in the front pannel also. but i cant put the box in the image window in the front pannel. if u click the mouse in the image window in the front pannel it will display the 25x25pixel values.
    i want both to be done in a same window i want to put a multiple square box and the pixel values i want to extract seperately for the individual boxes. please help me give some ideas how to do this please modify this vi.
    thank u
    sasi
    Attachments:
    mult sqr.vi ‏123 KB

    Please refer to this duplicate post for response:
    http://forums.ni.com/ni/board/message?board.id=170​&message.id=105711

  • Help needed trying make thumbnails from large Image Files

    I posted this to the Flex message bored, too. I didn't notice
    the Actionscript 3.0 until after. Sorry. Anyway, I have some
    ActionScript 3.0 code, created with Flex that will load a large
    JPEG image (say 3000x2000 pixels) that I'm trying to create a 100
    pixel thumbnail. I have the code working where I generate the
    thumbnail, but it's not maintaining the aspect ratio of the
    original image. It's making it square, filling in white for the
    part that doesn't fit.
    I've tried just setting the height or width of the new
    image, but that doesnt render well, either.
    To see what I'm talking about, I made a screen shot, showing
    the before image, and the rendered as thumbnail image:
    Image of demo
    app at Flickr.
    Now, there's a few things important to note. I'm saving the
    thumbnail off as a JPEG. As you can see in my sample application,
    the original renders fine with the proper aspect ratio, it's when
    I'm copying the bytes off the bitmapdata object, where I need to
    specify a width and height, that the trouble starts. I've also
    tried using .contentHeight and .contentWidth and some division to
    manually specify a new bitmapdatasize, but these values seem to
    always have NaN.
    private function makeThumbnail():void{
    // create a thumbnail of 100x100 pixels of a large file
    // What I want to create is a a thumbnail with the longest
    size of the aspect
    // ratio to be 100 pixels.
    var img:Image = new Image();
    //Add this event listener because we cant copy the
    BitmapData from an
    /// image until it is loaded.
    img.addEventListener(FlexEvent.UPDATE_COMPLETE,
    imageLoaded);
    img.width=100;
    img.height=100;
    img.scaleContent=true;
    img.visible = true;
    // This is the image we want to make a thumbnail of.
    img.load("file:///C:/T5.jpg");
    img.id = "testImage";
    this.addChildAt(img, 0);
    private function imageLoaded(event:Event):void
    // Grab the bitmap image from the Input Image and
    var bmd:BitmapData =
    getBitmapDataFromUIComponent(UIComponent(event.target));
    //Render the new thumbnail in the UI to see what it looks
    theImage.source = new Bitmap(bmd); //new Bitmap(bmd);
    public static function
    getBitmapDataFromUIComponent(component:UIComponent):BitmapData
    var bmd:BitmapData = new
    BitmapData(component.width,component.height );
    bmd.draw(component);
    return bmd;
    }

    Hi Tod,
    Take a look at this post:
    I'll have to say the smoothing of the thumb is not perfect, but maybe in combination with your code.. you get good results.
    Post a solution if you acheive better smooth thumb results.
    Link to forum post:http://forums.adobe.com/message/260127#260127
    Greets, Jacob

  • Please help I keep getting this message, cannot open files from server

    Nov 18 11:47:25 design-2s-mac-pro.local mdworker[1046]: (Normal) Import: Using too many resources after 1920 files (wired: 0 resident: 3358 swapped: 0 regions: 2076), hit usage threshold importing /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tearoff. tcl, exiting to clean up now.
    a window pops up with the warning "The software cannot be found" along with a "Document" icon - the blank sheet of paper with the corner folded down.

    Getting this message from what application?  Are you in the terminal?   What are you doing?

  • Location of image files, dat files etc.. in a project

    hi,
    I dont whether this is the proper location to ask this question but i couldnt find answer anywhere else.
    I am using netbeans 5.0 to write some jsp pages. I want to display some image file in the jsp. I tried all posiblle locations for locating the image file but all the time i was getting file not found error when try to open the image in the browser using http address. I wasted lot of time on this issue nd couldnt proceed further because of this silly error.
    Please help me out...where the image file should be located in netbeans 5.0 so that it can be displayed in jsp pages.
    thanx

    I generally put an images directory in the web-app directory (alongside the jsps) and put the images there. then refer to them, as <img src="images/xxxxxx.png">

  • How I can open Image File

    I guess it is simple but I do not know how I can in this class open Image file. This code should go instead of the line:
    window.setSize(450,300);
    Please, help me.
    Pan.
    class ItemHandler implements ActionListener {
              public void actionPerformed( ActionEvent e )
                   for ( int i = 0; i < techItems.length;i++ );
                   if (techItems[ i ].isSelected() ){
                   window.setSize(450,300);
                   break;
                   repaint();
         }

    The easiest way is to use a JLabel where you have an image. Something like this:
    JLabel lbl = new JLabel(new ImageIcon("icon.gif"));
    JPanel p = new JPanel();
    p.add(lbl);
    Klint

  • How can i display a image file which is placed in the applications server

    Hi all,
    Can any one help me how can I display a image file which is present in the application server.
    With regards,
    M.Ramana Murthy

    hi,
    *& Form TOP_OF_PAGE
    * text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo = Logo name
    * I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    rgds
    Anver

  • A performance issue when opening report calls image file

    Hi All,
    I use Oracle reports version 10gR2. When the client user press preview button to display the Oracle report it takes an excessive amount of time. This report displays image file (*.tiff), the image file stored in another server not the application server or database server. I copy the image file first from this machine to the client machine then display the report from the client machine. But still takes time.
    Thanks & regards,
    Walid

    Hi All,
    I use Oracle reports version 10gR2. When the client user press preview button to display the Oracle report it takes an excessive amount of time. This report displays image file (*.tiff), the image file stored in another server not the application server or database server. I copy the image file first from this machine to the client machine then display the report from the client machine. But still takes time.
    Thanks & regards,
    Walid

  • How do i save my drawing as an image file?

    hiee
    I have made a drawing panel on an Internal frame.
    I can draw basic 2D shapes on it.
    Now , i wanted to save this as an image file (ie.gif or jpeg).
    How do i do that??

    * SaveAsGif_Demo.java
    * Created on 13 mars 2005, 11:26
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.Dictionary;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import java.util.NoSuchElementException;
    import javax.swing.*;
    * @author  Andr� Uhres
    public class SaveAsGif_Demo extends javax.swing.JFrame {
        /** Creates new form SaveAsGif_Demo */
        public SaveAsGif_Demo() {
            initComponents();
            myPanel = new MyPanel();
            getContentPane().add(myPanel, BorderLayout.CENTER);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {                         
            jToolBar1 = new javax.swing.JToolBar();
            jButton1 = new javax.swing.JButton();
            jLabel1 = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Save as .gif Demo");
            jToolBar1.setFloatable(false);
            jButton1.setText("Save");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jToolBar1.add(jButton1);
            jToolBar1.add(jLabel1);
            getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300);
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            File file = new File("c:\\test.gif");
            if(SaveAsPic.saveGif(file, myPanel.captureJPanel(myPanel))){
                jLabel1.setText("The diagram was saved as " + file.getAbsolutePath());
                return;
            jLabel1.setText("Error:failed to save as gif");
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new SaveAsGif_Demo().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JToolBar jToolBar1;
        // End of variables declaration                  
        private MyPanel myPanel;
    class MyPanel extends JPanel {
        MyPanel(){
            super();
        public void paint(Graphics g){
            g.drawRect(10, 10, 100,100);
        Image i ;
        public Image captureJPanel( JPanel jp ) {
            i = this.createImage( jp.getSize().height, jp.getSize().width );
            Graphics g = i.getGraphics();
            jp.paint( g );
            return i;
    class SaveAsPic {
        public static boolean saveGif(File file, Image image) {
            boolean flag = true;
            try {
                FileOutputStream fileoutputstream = new FileOutputStream(file);
                GifEncoder gifencoder = new GifEncoder(image, fileoutputstream);
                gifencoder.encode();
                fileoutputstream.close();
            catch(IOException ioexception) {
                System.out.println("Error encoding Gif-file: " + ioexception.getMessage());
                flag = false;
            return flag;
        SaveAsPic() {
    class IntHashtableEnumerator
        implements Enumeration {
        IntHashtableEnumerator(IntHashtableEntry ainthashtableentry[], boolean flag) {
            table = ainthashtableentry;
            keys = flag;
            index = ainthashtableentry.length;
        public boolean hasMoreElements() {
            if(entry != null)
                return true;
            while(index-- > 0)
                if((entry = table[index]) != null)
                    return true;
            return false;
        public Object nextElement() {
            if(entry == null)
                while(index-- > 0 && (entry = table[index]) == null) ;
            if(entry != null) {
                IntHashtableEntry inthashtableentry = entry;
                entry = inthashtableentry.next;
                if(keys)
                    return new Integer(inthashtableentry.key);
                else
                    return inthashtableentry.value;
            } else {
                throw new NoSuchElementException("IntHashtableEnumerator");
        boolean keys;
        int index;
        IntHashtableEntry table[];
        IntHashtableEntry entry;
    class IntHashtableEntry {
        protected Object clone() {
            IntHashtableEntry inthashtableentry = new IntHashtableEntry();
            inthashtableentry.hash = hash;
            inthashtableentry.key = key;
            inthashtableentry.value = value;
            inthashtableentry.next = next == null ? null : (IntHashtableEntry)next.clone();
            return inthashtableentry;
        IntHashtableEntry() {
        int hash;
        int key;
        Object value;
        IntHashtableEntry next;
    class IntHashtable extends Dictionary
        implements Cloneable {
        public IntHashtable(int i, float f) {
            if(i <= 0 || (double)f <= 0.0D) {
                throw new IllegalArgumentException();
            } else {
                loadFactor = f;
                table = new IntHashtableEntry;
    threshold = (int)((float)i * f);
    return;
    public IntHashtable(int i) {
    this(i, 0.75F);
    public IntHashtable() {
    this(101, 0.75F);
    public int size() {
    return count;
    public boolean isEmpty() {
    return count == 0;
    public synchronized Enumeration keys() {
    return new IntHashtableEnumerator(table, true);
    public synchronized Enumeration elements() {
    return new IntHashtableEnumerator(table, false);
    public synchronized boolean contains(Object obj) {
    if(obj == null)
    throw new NullPointerException();
    IntHashtableEntry ainthashtableentry[] = table;
    for(int i = ainthashtableentry.length; i-- > 0;) {
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[i]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.value.equals(obj))
    return true;
    return false;
    public synchronized boolean containsKey(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i)
    return true;
    return false;
    public synchronized Object get(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i)
    return inthashtableentry.value;
    return null;
    public Object get(Object obj) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return get(i);
    protected void rehash() {
    int i = table.length;
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i * 2 + 1;
    IntHashtableEntry ainthashtableentry1[] = new IntHashtableEntry[j];
    threshold = (int)((float)j * loadFactor);
    table = ainthashtableentry1;
    for(int k = i; k-- > 0;) {
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null;) {
    IntHashtableEntry inthashtableentry1 = inthashtableentry;
    inthashtableentry = inthashtableentry.next;
    int l = (inthashtableentry1.hash & 0x7fffffff) % j;
    inthashtableentry1.next = ainthashtableentry1[l];
    ainthashtableentry1[l] = inthashtableentry1;
    public synchronized Object put(int i, Object obj) {
    if(obj == null)
    throw new NullPointerException();
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i) {
    Object obj1 = inthashtableentry.value;
    inthashtableentry.value = obj;
    return obj1;
    if(count >= threshold) {
    rehash();
    return put(i, obj);
    } else {
    IntHashtableEntry inthashtableentry1 = new IntHashtableEntry();
    inthashtableentry1.hash = j;
    inthashtableentry1.key = i;
    inthashtableentry1.value = obj;
    inthashtableentry1.next = ainthashtableentry[k];
    ainthashtableentry[k] = inthashtableentry1;
    count++;
    return null;
    public Object put(Object obj, Object obj1) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return put(i, obj1);
    public synchronized Object remove(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    IntHashtableEntry inthashtableentry = ainthashtableentry[k];
    IntHashtableEntry inthashtableentry1 = null;
    for(; inthashtableentry != null; inthashtableentry = inthashtableentry.next) {
    if(inthashtableentry.hash == j && inthashtableentry.key == i) {
    if(inthashtableentry1 != null)
    inthashtableentry1.next = inthashtableentry.next;
    else
    ainthashtableentry[k] = inthashtableentry.next;
    count--;
    return inthashtableentry.value;
    inthashtableentry1 = inthashtableentry;
    return null;
    public Object remove(Object obj) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return remove(i);
    public synchronized void clear() {
    IntHashtableEntry ainthashtableentry[] = table;
    for(int i = ainthashtableentry.length; --i >= 0;)
    ainthashtableentry[i] = null;
    count = 0;
    public synchronized Object clone() {
    try {
    IntHashtable inthashtable = (IntHashtable)super.clone();
    inthashtable.table = new IntHashtableEntry[table.length];
    for(int i = table.length; i-- > 0;)
    inthashtable.table[i] = table[i] == null ? null : (IntHashtableEntry)table[i].clone();
    return inthashtable;
    catch(CloneNotSupportedException _ex) {
    throw new InternalError();
    public synchronized String toString() {
    int i = size() - 1;
    StringBuffer stringbuffer = new StringBuffer();
    Enumeration enumeration = keys();
    Enumeration enumeration1 = elements();
    stringbuffer.append("{");
    for(int j = 0; j <= i; j++) {
    String s = enumeration.nextElement().toString();
    String s1 = enumeration1.nextElement().toString();
    stringbuffer.append(s + "=" + s1);
    if(j < i)
    stringbuffer.append(", ");
    stringbuffer.append("}");
    return stringbuffer.toString();
    private IntHashtableEntry table[];
    private int count;
    private int threshold;
    private float loadFactor;
    abstract class ImageEncoder
    implements ImageConsumer {
    public ImageEncoder(Image image, OutputStream outputstream) throws IOException {
    this(image.getSource(), outputstream);
    public ImageEncoder(ImageProducer imageproducer, OutputStream outputstream) throws IOException {
    width = -1;
    height = -1;
    started = false;
    accumulate = false;
    producer = imageproducer;
    out = outputstream;
    abstract void encodeStart(int i, int j) throws IOException;
    abstract void encodePixels(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException;
    abstract void encodeDone() throws IOException;
    public synchronized void encode() throws IOException {
    encoding = true;
    iox = null;
    producer.startProduction(this);
    while(encoding)
    try {
    wait();
    catch(InterruptedException _ex) { }
    if(iox != null)
    throw iox;
    else
    return;
    private void encodePixelsWrapper(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException {
    if(!started) {
    started = true;
    encodeStart(width, height);
    if((hintflags & 2) == 0) {
    accumulate = true;
    accumulator = new int[width * height];
    if(accumulate) {
    for(int k1 = 0; k1 < l; k1++)
    System.arraycopy(ai, k1 * j1 + i1, accumulator, (j + k1) * width + i, k);
    return;
    } else {
    encodePixels(i, j, k, l, ai, i1, j1);
    return;
    private void encodeFinish() throws IOException {
    if(accumulate) {
    encodePixels(0, 0, width, height, accumulator, 0, width);
    accumulator = null;
    accumulate = false;
    private synchronized void stop() {
    encoding = false;
    notifyAll();
    public void setDimensions(int i, int j) {
    width = i;
    height = j;
    public void setProperties(Hashtable hashtable) {
    props = hashtable;
    public void setColorModel(ColorModel colormodel) {
    public void setHints(int i) {
    hintflags = i;
    public void setPixels(int i, int j, int k, int l, ColorModel colormodel, byte abyte0[], int i1,
    int j1) {
    int ai[] = new int[k];
    for(int k1 = 0; k1 < l; k1++) {
    int l1 = i1 + k1 * j1;
    for(int i2 = 0; i2 < k; i2++)
    ai[i2] = colormodel.getRGB(abyte0[l1 + i2] & 0xff);
    try {
    encodePixelsWrapper(i, j + k1, k, 1, ai, 0, k);
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    return;
    public void setPixels(int i, int j, int k, int l, ColorModel colormodel, int ai[], int i1,
    int j1) {
    if(colormodel == rgbModel) {
    try {
    encodePixelsWrapper(i, j, k, l, ai, i1, j1);
    return;
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    return;
    int ai1[] = new int[k];
    for(int k1 = 0; k1 < l; k1++) {
    int l1 = i1 + k1 * j1;
    for(int i2 = 0; i2 < k; i2++)
    ai1[i2] = colormodel.getRGB(ai[l1 + i2]);
    try {
    encodePixelsWrapper(i, j + k1, k, 1, ai1, 0, k);
    catch(IOException ioexception1) {
    iox = ioexception1;
    stop();
    return;
    public void imageComplete(int i) {
    producer.removeConsumer(this);
    if(i == 4)
    iox = new IOException("image aborted");
    else
    try {
    encodeFinish();
    encodeDone();
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    protected OutputStream out;
    private ImageProducer producer;
    private int width;
    private int height;
    private int hintflags;
    private boolean started;
    private boolean encoding;
    private IOException iox;
    private static final ColorModel rgbModel = ColorModel.getRGBdefault();
    private Hashtable props;
    private boolean accumulate;
    private int accumulator[];
    class GifEncoderHashitem {
    public GifEncoderHashitem(int i, int j, int k, boolean flag) {
    rgb = i;
    count = j;
    index = k;
    isTransparent = flag;
    public int rgb;
    public int count;
    public int index;
    public boolean isTransparent;
    class GifEncoder extends ImageEncoder {
    public GifEncoder(Image image, OutputStream outputstream) throws IOException {
    super(image, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    public GifEncoder(Image image, OutputStream outputstream, boolean flag) throws IOException {
    super(image, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    interlace = flag;
    public GifEncoder(ImageProducer imageproducer, OutputStream outputstream) throws IOException {
    super(imageproducer, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    public GifEncoder(ImageProducer imageproducer, OutputStream outputstream, boolean flag) throws IOException {
    super(imageproducer, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    interlace = flag;
    void encodeStart(int i, int j) throws IOException {
    width = i;
    height = j;
    rgbPixels = new int[j][i];
    void encodePixels(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException {
    for(int k1 = 0; k1 < l; k1++)
    System.arraycopy(ai, k1 * j1 + i1, rgbPixels[j + k1], i, k);
    void encodeDone() throws IOException {
    int i = -1;
    int j = -1;
    colorHash = new IntHashtable();
    int k = 0;
    for(int l = 0; l < height; l++) {
    for(int i1 = 0; i1 < width; i1++) {
    int j1 = rgbPixels[l][i1];
    boolean flag = j1 >>> 24 < 128;
    if(flag)
    if(i < 0) {
    i = k;
    j = j1;
    } else
    if(j1 != j)
    rgbPixels[l][i1] = j1 = j;
    GifEncoderHashitem gifencoderhashitem = (GifEncoderHashitem)colorHash.get(j1);
    if(gifencoderhashitem == null) {
    if(k >= 256)
    throw new IOException("too many colors for a GIF");
    gifencoderhashitem = new GifEncoderHashitem(j1, 1, k, flag);
    k++;
    colorHash.put(j1, gifencoderhashitem);
    } else {
    gifencoderhashitem.count++;
    byte byte0;
    if(k <= 2)
    byte0 = 1;
    else
    if(k <= 4)
    byte0 = 2;
    else
    if(k <= 16)
    byte0 = 4;
    else
    byte0 = 8;
    int k1 = 1 << byte0;
    byte abyte0[] = new byte[k1];
    byte abyte1[] = new byte[k1];
    byte abyte2[] = new byte[k1];
    for(Enumeration enumeration = colorHash.elements(); enumeration.hasMoreElements();) {
    GifEncoderHashitem gifencoderhashitem1 = (GifEncoderHashitem)enumeration.nextElement();
    abyte0[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb >> 16 & 0xff);
    abyte1[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb >> 8 & 0xff);
    abyte2[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb & 0xff);
    GIFEncode(super.out, width, height, interlace, (byte)0, i, byte0, abyte0, abyte1, abyte2);
    byte GetPixel(int i, int j) throws IOException {
    GifEncoderHashitem gifencoderhashitem = (GifEncoderHashitem)colorHash.get(rgbPixels[j][i]);
    if(gifencoderhashitem == null)
    throw new IOException("color not found");
    else
    return (byte)gifencoderhashitem.index;
    static void writeString(OutputStream outputstream, String s) throws IOException {
    byte abyte0[] = s.getBytes();
    outputstream.write(abyte0);
    void GIFEncode(OutputStream outputstream, int i, int j, boolean flag, byte byte0, int k, int l,
    byte abyte0[], byte abyte1[], byte abyte2[]) throws IOException {
    Width = i;
    Height = j;
    Interlace = flag;
    int k1 = 1 << l;
    int j1;
    int i1 = j1 = 0;
    CountDown = i * j;
    Pass = 0;
    int l1;
    if(l <= 1)
    l1 = 2;
    else
    l1 = l;
    curx = 0;
    cury = 0;
    writeString(outputstream, "GIF89a");
    Putword(i, outputstream);
    Putword(j, outputstream);
    char c = '\uFF80';
    c |= 'p';
    c |= (byte)(l - 1);
    Putbyte((byte)c, outputstream);
    Putbyte(byte0, outputstream);
    Putbyte((byte)0, outputstream);
    for(int i2 = 0; i2 < k1; i2++) {
    Putbyte(abyte0[i2], outputstream);
    Putbyte(abyte1[i2], outputstream);
    Putbyte(abyte2[i2], outputstream);
    if(k != -1) {
    Putbyte((byte)33, outputstream);
    Putbyte((byte)-7, outputstream);
    Putbyte((byte)4, outputstream);
    Putbyte((byte)1, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)k, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)44, outputstream);
    Putword(i1, outputstream);
    Putword(j1, outputstream);
    Putword(i, outputstream);
    Putword(j, outputstream);
    if(flag)
    Putbyte((byte)64, outputstream);
    else
    Putbyte((byte)0, outputstream);
    Putbyte((byte)l1, outputstream);
    compress(l1 + 1, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)59, outputstream);
    void BumpPixel() {
    curx++;
    if(curx == Width) {
    curx = 0;
    if(!Interlace) {
    cury++;
    return;
    switch(Pass) {
    default:
    break;
    case 0: // '\0'
    cury += 8;
    if(cury >= Height) {
    Pass++;
    cury = 4;
    return;
    break;
    case 1: // '\001'
    cury += 8;
    if(cury >= Height) {
    Pass++;
    cury = 2;
    return;
    break;
    case 2: // '\002'
    cury += 4;
    if(cury >= Height) {
    Pass++;
    cury = 1;
    return;
    break;
    case 3: // '\003'
    cury += 2;
    return;
    int GIFNextPixel() throws IOException {
    if(CountDown == 0) {
    return -1;
    } else {
    CountDown--;
    byte byte0 = GetPixel(curx, cury);
    BumpPixel();
    return byte0 & 0xff;
    void Putword(int i, OutputStream outputstream) throws IOException {
    Putbyte((byte)(i & 0xff), outputstream);
    Putbyte((byte)(i >> 8 & 0xff), outputstream);
    void Putbyte(byte byte0, OutputStream outputstream) throws IOException {
    outputstream.write(byte0);
    final int MAXCODE(int i) {
    return (1 << i) - 1;
    void compress(int i, OutputStream outputstream) throws IOException {
    g_init_bits = i;
    clear_flg = false;
    n_bits = g_init_bits;
    maxcode = MAXCODE(n_bits);
    ClearCode = 1 << i - 1;
    EOFCode = ClearCode + 1;
    free_ent = ClearCode + 2;
    char_init();
    int j1 = GIFNextPixel();
    int i2 = 0;
    for(int j = hsize; j < 0x10000; j *= 2)
    i2++;
    i2 = 8 - i2;
    int l1 = hsize;
    cl_hash(l1);
    output(ClearCode, outputstream);
    int i1;
    label0:
    while((i1 = GIFNextPixel()) != -1) {
    int k = (i1 << maxbits) + j1;
    int l = i1 << i2 ^ j1;
    if(htab[l] == k) {
    j1 = codetab[l];
    continue;
    if(htab[l] >= 0) {
    int k1 = l1 - l;
    if(l == 0)
    k1 = 1;
    do {
    if((l -= k1) < 0)
    l += l1;
    if(htab[l] == k) {
    j1 = codetab[l];
    continue label0;
    } while(htab[l] >= 0);
    output(j1, outputstream);
    j1 = i1;
    if(free_ent < maxmaxcode) {
    codetab[l] = free_ent++;
    htab[l] = k;
    } else {
    cl_block(outputstream);
    output(j1, outputstream);
    output(EOFCode, outputstream);
    void output(int i, OutputStream outputstream) throws IOException {
    cur_accum &= masks[cur_bits];
    if(cur_bits > 0)
    cur_accum |= i << cur_bits;
    else
    cur_accum = i;
    for(cur_bits += n_bits; cur_bits >= 8; cur_bits -= 8) {
    char_out((byte)(cur_accum & 0xff), outputstream);
    cur_accum >>= 8;
    if(free_ent > maxcode || clear_flg)
    if(clear_flg) {
    maxcode = MAXCODE(n_bits = g_init_bits);
    clear_flg = false;
    } else {
    n_bits++;
    if(n_bits == maxbits)
    maxcode = maxmaxcode;
    else
    maxcode = MAXCODE(n_bits);
    if(i == EOFCode) {
    for(; cur_bits > 0; cur_bits -= 8) {
    char_out((byte)(cur_accum & 0xff), outputstream);
    cur_accum >>= 8;
    flush_char(outputstream);
    void cl_block(OutputStream outputstream) throws IOException {
    cl_hash(hsize);
    free_ent = ClearCode + 2;
    clear_flg = true;
    output(ClearCode, outputstream);
    void cl_hash(int i) {
    for(int j = 0; j < i; j++)
    htab[j] = -1;
    void char_init() {
    a_count = 0;
    void char_out(byte byte0, OutputStream outputstream) throws IOException {
    accum[a_count++] = byte0;
    if(a_count >= 254)
    flush_char(outputstream);
    void flush_char(OutputStream outputstream) throws IOException {
    if(a_count > 0) {
    outputstream.write(a_count);
    outputstream.write(accum, 0, a_count);
    a_count = 0;
    private boolean interlace;
    int width;
    int height;
    int rgbPixels[][];
    IntHashtable colorHash;
    int Width;
    int Height;
    boolean Interlace;
    int curx;
    int cury;
    int CountDown;
    int Pass;
    static final int EOF = -1;
    static final int BITS = 12;
    static final int HSIZE = 5003;
    int n_bits;
    int maxbits;
    int maxcode;
    int maxmaxcode;
    int htab[];
    int codetab[];
    int hsize;
    int free_ent;
    boolean clear_flg;
    int g_init_bits;
    int ClearCode;
    int EOFCode;
    int cur_accum;
    int cur_bits;
    int masks[] = {
    0, 1, 3, 7, 15, 31, 63, 127, 255, 511,
    1023, 2047, 4095, 8191, 16383, 32767, 65535
    int a_count;
    byte accum[];

  • How come 5.0 can't open local desktop images files (.jpg, .tif, .png ...) on my Mac anymore?

    I'm using Mac 10.6.8 and the newest version of Firefox 5.0. I have always been able to select File > Open File from the Firefox menu and select any image file on my computer and view it in the browser window. Suddenly I can't do this. All image files on my system are greyed out and not accessible. I can open html files from my local desktop and all images are present but can't open any .css files or single image files.

    Here's the *.tiff file.
    I've had to switch browser to Safari, as you can't load a tiff in Firefox, either.

  • Locked Image Files - Adam#1

    Here's the situation....
    Creating an iWeb site using the Gazette template for my college website. Everything is great until I want to change a published site on the college's non-Mac server. I can publish to my folder on the server great, but when I try to update the folder it tells me I don't have permission to trash the COLUMN DIVIDER image file in the IMAGE FOLDER. That's the only file I can't update on this PC Server.
    So everytime I want to publish again...I publish to my SITE USER folder....open up my folder on the non-pc server.....physcially trash everything but the COLUMN DIVIDER file, and then copy everything around that file.....
    It works dandy, but annoying...
    Any problems with that COLUMN DIVIDER creating a locked file...which it doesn't look like in the Info box?
    Any suggestions?
    Thanks,
    Adam

    Hi Adam...
    Another workaround that might make your site updating life easier is to use an FTP program like Captain FTP ( http://captainftp.xdsnet.de/ ) that actually has a syncronizing function built in to the upload function. This will allow you to upload only the files that have changed in your sitefolder. And since this "column divider" image file seems to be a template file, it will always be present in your sitefolder. So once it is uploaded, it is there for good...no need to delete and upload another copy, etc.
    Lots of people around here using Captain FTP for its sync function. For iWeb, I believe there is a setting that you need to disable....do a search in this forum...I think it is syncronize by date or something like that.

  • Are the image files on a Time Machine backup password protected?

    I have had a hard drive hooked up to my AirPort Express, backing up my computers to it using Time Machine.
    Now, the hard drive is broken and I have to return it to the dealer to have it replaced as it is still covered by their warranty.
    My question is, will they be able to access my personal data?
    I have to enter a password to access the disk over the network, does this mean the image files on it are also password protected?
    I know it's not very likely they have any interest in browsing my files, but I don't like the idea to just give everything away.
    The disk won't spin so I can't format the drive.

    TZW wrote:
    I have had a hard drive hooked up to my AirPort Express, backing up my computers to it using Time Machine.
    Now, the hard drive is broken and I have to return it to the dealer to have it replaced as it is still covered by their warranty.
    My question is, will they be able to access my personal data?
    I have to enter a password to access the disk over the network, does this mean the image files on it are also password protected?
    I know it's not very likely they have any interest in browsing my files, but I don't like the idea to just give everything away.
    The disk won't spin so I can't format the drive.
    If the disk isn't spinning it is unlikely to be repaired.. And if you passworded the disk people would need the password to access although given time all those things can be broken.. I would say you have little to fear.

  • Do IMAQ Cast Image or IMAQ Linear averages give different results when using different computers that are running under Windows XP ?

    Hello
    I'm currently developping an image processing algorithm using Labview 7.1 and the associated IMAQ Vision tools. After several tests, I found a weird result. Indeed, I put the labview algorithm - including the IMAQ VI on the library to get sure that I use all the time the same VI - on my memory stick and used it on two different computers. I tested the same picture (still in my memory stick) and had two very different results.
    After several hours trying to understand why, I found that there were a difference between the results given by both computers at the very begining of the algorithm. Indeed, I used a JPEG file.
    To open it, I first create an Image with IMAQ Create (U8). Then, I open it.
    Then in my first sub-VI, I use IMAQ Cast Image to be sure that the picture is a U8 grayscale picture.
    Right after that, I use the IMAQ Linear Averages. The results of this VI are different on the two computers.
    I tried several time on the same picture : one computer always give me the same result but the two computers give me a different result. So there is no random variable on the results.
    So my question is : Do IMAQ Cast Image or IMAQ Linear averages give different results when using different computers that are running under Windows XP ?
    My bet is on IMAQ Cast Image but I'm not quite sure and I do not undestand why. The labview and IMAQ are the same on both computers.
    The difference between the two computer are above :
    Computer 1 :
    Pentium(R) 4 CPU 3.20GHz with a RAM of 1Go. The processor is an Intel(R).
    The OS is windows XP Pro 2002
    Computer 2 :
    Pentium(R) 4 CPU 2.80GHz with a RAM of 512Mo. The processor is an Intel(R).
    The OS is windows XP Pro 2002.
    If anybody can help me on this problem, it would be really helpful.
    Regards
    Florence P.

    Hi,
    Indeed it's a strange behaviour, could you send me your VI and your JPEG file, (or another file that reproduces) so that I could check this inthere ?
    I'll then try to find out what's happening.
    Regards
    Richard Keromen
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Découvrez, en vidéo, les innovations technologiques réalisées en éco-conception

  • What does the IMAQ Cast Image VI do exactly?

    Hi everyone,
    I want to convert a RGB image to grayscale. By now I can do this, using the IMAQ Cast Image VI. But now I was wondering what exacly does this VI do? How does it make a grayscale image from the RGB image? What is happening under the hood?
    Hope someone can tell me, since I really can't find it. Thanks in advance ^^.
    Solved!
    Go to Solution.

    For each type conversion there is specific operation. In your case The VI sets the destination value to the average of the three color components of the source.
    For more:
    http://zone.ni.com/reference/en-XX/help/370281P-01​/imaqvision/casting_images/
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • Error -1074396120 IMAQ Get Image Info Error "Not an image"

    Hello everyone,
    I'm currently working on Machine Vision project. It has to measure distance of small metal elements, which moves on a conveyor. I've built and tested measurement algorithm in NI Vision Builder and it worked really cool. Today I tried to migrate inspection to LabVIEW in order to add features connected with sensors which I use in my project. When migration completed I run a VI, and suddenly got error:
    Error -1074396120 occured at IMAQ Get Image Info
    Not an image.
    I use in my project Logitech Pro 9000, and I can see it in MAX. I acquire image in 640x480 resolution as RGB2. I read somewhere that it could be caused by RGB colors of image. In my algorithm after acquiring image is thresholded in order to get binary image.
    Please tell me which block diagrams should I attach to this post to make it more understandable for you (if it is needed). Is it possible to fix this error ? Did anyone sorted it out already ? Thanks for any help.
    Best regards,
    Michael

    First of all I would like to apologize for long delay in replying and thank you for your replies.
    @toto26:
    Yes, I used before threshold function a function you mentioned. The problem is that my algorithm works correctly in Vision Builder, but after migrating to LabVIEW, when I run a VI it doesn't work. It's strange for me.
    The problem also occurs when I made my algorithm as simple as possible - now it includes two steps: acquisition and find edge function. After migration it still cannot acquire an image. Below I present an error and a place where it occurs (process ID already in use):
    I think that it would be easier and faster when I understand IMAQ functions. I want to build my algorithm from the beginning in LabVIEW, because I would be aware of every part of my program. Please tell me if it is possible with my camera. Could you suggest me where can I find information about building vision application in LabVIEW for beginners. What keywords should I look for.
    Thanks for any advice,
    Michael

Maybe you are looking for

  • Delta issue for 0FC_BP_ITEMS

    Hello Gurus, This is a question on Delta extraction for datasource 0FC_BP_ITEMS, which loads FI-CA data. I am using the 0FC_BP_ITEMS to load FI-CA related information to 0FC_DS05. The init load works fine. But when I execute the delta infopackage it

  • WPC: unable to add different resources with the same name into a WPC page

    Hi, I got a WPC problem when adding different KM resources with the same name into a WPC page.  Only one KM resource is able to be added in WPC. For example: There two "article.html" with different content and RID: 1. /company_a/article.html 2. /comp

  • Music services failed to load an unexpected error occurred

    Hi! Till the last Day, the WiFi and/ore the USB-Sync with iTunes runs perfectly. But at this moment, it doens't work anymore and i got this message on my DM6 "Music services failed to load an unexpected error occurred" I don't know why, cause i didn'

  • Overlib images dissapear under Flash movie

    Hi all, Total noob with flash. I have some thumbnail images on my page, when you mouse over the images an overlib pops up with the full image. Not far above the thubmnails is a flash header, when the overlib images pop up part of them is going undern

  • How to add contact in my email contact list ini-pad mini ?

    How do I add contact in email contact list on my iPad mini ?