cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

gray scale color table

Resolvido!
Ir para a solução
I want to make a picture out of an 8-bit unsigned integer 2D matrix of data. I can successfully do that using the "draw unflattened pixmap" function. However, it requires a color map. If you don't wire the color map, it uses the default labview color map. I want to use a gray scale color map (numbers between 0 and 255 corresponding to colors ranging from white to black). I am not sure how to make this color map and implement it. I appreciate any help.
0 Kudos
Mensagem 1 de 10
8.894Exibições

Make a 1-D array of U8: 0x00, 0x01, 0x02, 0x03, ..., 0xFF

 

 

George ZOU

http://www.geocities.com/gzou999

 

George Zou
0 Kudos
Mensagem 2 de 10
8.887Exibições
Thank you very much for the suggestion. But I am not sure what the x stands for in 0x00 and what is FF? Is it hexadecimal? If yes, then what is x? I appreciate the help.
0 Kudos
Mensagem 3 de 10
8.873Exibições

Hi Jahan,

 

yes, "0x" stands for hexadecimal numbers! Just right-click any numeric control/indicator/constant, select hexadecimal representationand the x is shown at the left border...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Mensagem 4 de 10
8.871Exibições

Thank you very much for the help. But still I am not understanding this correctly.

 

1)- First of all why hexadecimal?

 

2)- Second: I am using a loop to generate a 1D array of unsigned 8 bit integers from 0 to 255. I am using the loop counter "i" to do that. I tried to convert the loop counter to hexadecimal, but I was not sure how.

 

3)- Also, I could not get an 0x to appear at the left corner of a number after I changed the representation to hexadecimal.

 

4)- I did not find a function that takes a number and converts it to hexadecimal. I am using LabVIEW 7. Where is this function?

 

 

Sorry for asking too many questions. I hope you will have time to answer.

0 Kudos
Mensagem 5 de 10
8.869Exibições

Jahan wrote:

Thank you very much for the help. But still I am not understanding this correctly.

 

1)- First of all why hexadecimal?


I don't think George had any particular reason. Sometimes it's just easier to represent numbes in hexadecimal format. It's still the same number, it's just displayed differently. Hex FF = decimal 255. Same number.

 


2)- Second: I am using a loop to generate a 1D array of unsigned 8 bit integers from 0 to 255. I am using the loop counter "i" to do that. I tried to convert the loop counter to hexadecimal, but I was not sure how.

 You don't need to do that. The values of the numbers is what's important, and as I indicated it will still be the same whether you display it in decimal or hexadecimal format. 

 


3)- Also, I could not get an 0x to appear at the left corner of a number after I changed the representation to hexadecimal.


 You need to enable the "radix" display. When you right-click on the constant or control and select Properties it's on the Appearance page, marked "Show radix".

 


4)- I did not find a function that takes a number and converts it to hexadecimal. I am using LabVIEW 7. Where is this function?


There isn't one because there's no need to do so. The value of the number doesn't change. There are, however, functions to convert from/to hexadecimal strings, but that's something different.

 

 

 

0 Kudos
Mensagem 6 de 10
8.852Exibições
0 Kudos
Mensagem 7 de 10
8.845Exibições
The part about making each R, G,and B values the same is what was missing from George's response. Yes, to get a grayscale color map you can just have a loop to generate the 256 entries and use the RGB to Color VI to get your color by setting the R, G, and B values to the same value (i.e., the iteration loop). Is there a better way? Well, I suppose you could just have the resultant array as a block diagram constant. That would eliminate having to generate it "on the fly".
0 Kudos
Mensagem 8 de 10
8.829Exibições
Solução
Aceita pelo autor do tópico Jahan

Jahan wrote:

Yes, this is technically correct (top). (Typically you can do it once, then right-click the indicator and "change to constant" and delete the loop code.)

 

You might also flatten the rgb tool code to the diagram (bottom). This has the advantage that the entirel loop will be calculated once at compile time and internally folded into a constant so the loop actually never spins during execution of the program (See also). (Of course this particular loop is trivial and nothing to worry about, performance wise. ;)) 

 

 

 

Message Edited by altenbach on 03-14-2009 09:57 AM
Mensagem 9 de 10
8.824Exibições
Thank you all for your help and suggestions. I will do the constant array trick to eliminate extra spinning of the loop. Cheers. On my front, I consider the problem solved (for the time being):smileyvery-happy:
0 Kudos
Mensagem 10 de 10
8.813Exibições