LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert cluster of red,green,blue to array?

hi guys,
 
I have a this problem while i extract colour value from an image. it comes as a cluster of red, green, blue. i want to separate it into 3 arrays. i have already made it into 1-d cluster but i don't know what to do next. i have try all functions in cluster menu but they don't work.
please help me.
0 Kudos
Message 1 of 7
(3,643 Views)
I'm not sure I understand - how are you getting your data? Are you extracting the color for each pixel as a cluster of 3 elements? If you are, simply unbundle the cluster inside the loop where you do this and wire the output terminals of the unbundle node out of the loop. This will automatically build them into 3 1D arrays.
 
If this isn't what you're doing, I suggest you post your code so we can have a look at it.
 
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,635 Views)
Your question is not very clear. Easiest would be if you could create a small VI that contains some sample data either as default values in a control or as a diagram constant.
 
I don't know what a 1D cluster is. Is it a 1D array of clusters? A cluster of 1D arrays? Something entirely different?
0 Kudos
Message 3 of 7
(3,633 Views)
here is my block diagram . i used functions in IMAQ Visions, as u can see. Thanks for ur help !!!
0 Kudos
Message 4 of 7
(3,624 Views)

All you have to do is wire the 2D array into 2 nested for loops and inside the inner loop place an unbundle and wire the 3 results out of the loop, just like I said in my last post. You will now have 3 2D U8 array, one for R, one for G and one for B.

This is basic array\cluster manipulation. You really should check out those tutorials I mentioned.


___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(3,613 Views)
OK, let's backup a few steps 😉
 
It seems you have your image as a 2D U32 Array (blue) hat you feed into an array that turns it into a 2D array of RGB clusters and now you want to make 3 1D arrays, one for R, G and B, resp.
 
SO... the question is: Why do you do this expensive (memory and CPU) detour via the RGB cluster??? This makes absolutely no sense. You can get your desired result directly from the U32 array with a few easy steps. See attached image for one possibility to do this. 🙂
 
 
SInce you were talking about making 1D arrays, I reshaped the 2D array into a 1D array with a length corresponding to the product of the 2D dimensions. If you actually want to keep the RGB arrays as 2D, simply leave out the reshape function. 😉
 

Message Edited by altenbach on 08-28-2005 09:15 AM

Download All
0 Kudos
Message 6 of 7
(3,611 Views)
Oh, and BTW: See if there is a way to eliminate that stacked sequence structure. It does not seem necessary (it never is!) and only makes the diagram confusing and hard to read. 🙂
0 Kudos
Message 7 of 7
(3,601 Views)