LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Color to RGB and RGB to color - bug?

Solved!
Go to solution

Trying to optimize a image modifying part of a program i tried to parallellize an image modifying loop. It's hard to find a more fitting task for parallellisation, right?

To my surprise i gained 0 speed, and checking Color to RGB is showed to not be reentrant! Easy enough to fix, but i'd call that a bug since it shouldn't have been shipped like that.

Since the program after modifying some colors reassembles the image it also uses RGB to color, but that one is password locked, so it's stuck on non reentrant. 😞

 

LV2017

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 1 of 8
(4,355 Views)

Hi Yamaeda,

 

what about working with arrays of R, G and B - and use DecimateArray/InterleaveArray instead?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(4,340 Views)

I agree these VI's should be able to be re-entrant. I wonder why the color to RGB is password protected. Surely it is just the reverse of RGB to color. I assume you are able to just make your own color to RGB function with 3 split numbers to overcome your parallel problem.

Ian
LabVIEW since 2012
0 Kudos
Message 3 of 8
(4,336 Views)

@GerdW wrote:

Hi Yamaeda,

 

what about working with arrays of R, G and B - and use DecimateArray/InterleaveArray instead?



Yes that's a workaround, just like i can write a FFT on my own, but i expect the built in functions to be good enough. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 8
(4,325 Views)

Hi Yamaeda,

 

i expect the built in functions to be good enough.

Sure - but just for scalar values.

When working with images we often try to handle arrays - and those two RGB functions aren't polymorphic to support arrays…

 

On this password protected function: in older LV versions the function uses a CLFN to call a ResolveColor function in LabVIEW. And it used the UI thread to do so…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,312 Views)

@GerdW wrote:

Hi Yamaeda,

 

i expect the built in functions to be good enough.

Sure - but just for scalar values.

When working with images we often try to handle arrays - and those two RGB functions aren't polymorphic to support arrays…

 

On this password protected function: in older LV versions the function uses a CLFN to call a ResolveColor function in LabVIEW. And it used the UI thread to do so…


...

 

and if you check the help...

 

"

Resolves any color input, including system colors, into its respective red, green, and blue components.

"

 

... we find a hint why it is not just a matter of splitting the number and what maybe a call to the OS.

 

If you are not dealing with System colors, just use split number cascaded since it is polymorphic and will adapt to arrays.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 8
(4,286 Views)
Solution
Accepted by topic author Ben

Use this instead:

snip.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 8
(4,259 Views)

/Y

 

Look at the conversion on trim whitespace.  I suspect that similar arguments may apply.  NI does make an effort to write bullet proof code that is cross platform and localized.  That can make a "roll-your-own" solution much faster in the cases you will use it.  

 

I've often considered writing a "95 percent" TK.  But, the documentation to claim where the functions fail is prohibitive.


"Should be" isn't "Is" -Jay
Message 8 of 8
(4,252 Views)