From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you convert a "text image" onto an intensity graph?

I wish to create a VI which loads a 2D array of data and then displays it on the screen using the Intensity Graph. I am new to labview (used less than 3 months) and I was wondering if anyone could help? Thanks

 

0 Kudos
Message 1 of 9
(5,445 Views)

What is a "text image"? I am not familiar with that term.

 

What problems are you having? 

 

  • How to "laod" a 2D array, whtever that means? (from file? from daq device?, from a camera? etc.)
  • How to display it on an intensity graph or 2D picture?

What is the datatype of the 2D array?

 

Why don't you attach your VI and a typical datafile so we get a better idea on what this is all about. Thanks!

0 Kudos
Message 2 of 9
(5,435 Views)

Thankyou for your reply.

 

The text image is a black and white photo that has been converted to a text file using image j. (it basically finishes in .txt eg: image.txt)

I think my main problem is I dont know how to start with converting a 2d array, from a file, and displaying it onto an intensity graph.

I havent got a VI as of yet because I dont really know where to start but I can attach the "txt" files for you to see.

 

Many Thanks!

0 Kudos
Message 3 of 9
(5,432 Views)

You mean like this?

 

Read file...Spreadsheet string to array...flatten pixmap...draw flattened pixmap....

 

Message 4 of 9
(5,427 Views)

Note that an intensity graph has the origin in the lower left, so you would need to rotate the data in some way (start here :D). You also need to ensure that the intensity pixels are square to avoid distortions. A picture indicator is better for this (see previous post).

 

 

Message 5 of 9
(5,423 Views)
Thank you very much! Really appreciated.
Could you be so kind to tell me where on the panel to find both the yellow boxes? The read file and spreadsheet one? And where the array is? I cannot find them on the panel 😞
Much thanks again.
0 Kudos
Message 6 of 9
(5,281 Views)

Read from Text File (FIle IO palette) and Spreadsheet String to Array (string palette).

 

To create a 2D array diagram constant, you could just right-click the type input of "spreadsheet string to array" followed by "create constant". Now right-click the element and select the correct representation.

 

To create a 2D array diagram constant from scratch, drop an empty array container diagram constant from the array palette and drop a numeric diagram constant in it. Now resize the index terminal for two dimensions.

0 Kudos
Message 7 of 9
(5,278 Views)

Many Thanks! I have another quick question if that is ok?

I wish to increase the brightness of the picture and the contrast. I know I do this but adding numbers onto the array, or by multiplying, but how do I set this up on my block panel. Ive managed to rotate the picture also. Here is what it looks like now.

Thanks.

0 Kudos
Message 8 of 9
(5,215 Views)

Your picture is 8 bit, thus the values can only go from 0..255. Just multiplying would simply change the range, but would not do anything to the brightness or contrast, unless you don't autoscale. I am not sure why you are using a I32 array as type, U8 seems to be sufficient for the data in your file (it keeps memory use to 25% of what you are doing!).

 

Please attach your VI instead of a picture.

 

Also please don't place code in a loop that repeats the same operation on the same input millions of times per second. Once is enough, then recalculate whenever an input changes.

 

To change brightness/contrast you should just remap the values nonlinearly, keeping the overall range at 0...255. When using an image indicator, you would just change the color table. When using an intensity graph, just do some simple math in U8. There should not be much orange. For certain transformations, you could also just change the Z scale, no math on the data needed.

0 Kudos
Message 9 of 9
(5,201 Views)