Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Image from RGB Colorspace to CieLab Colorspace

I am wanting to process and analyze a jpg image stored on my computer. My goal is:

(1) look at a histogram of the pixels' three RGB color coordinates and

(2) convert the pixels' RGB color coordinates to CieLab colorspace so I can likewise obtain three histograms of the L, a and b values, as well as obtain some statistical data with respect to the three L, a and b populations (e.g., mean, standand deviation, mode, min, max, etc.).

To date, I have read and managed to identify one approach to accomplish step (1) above, however I have not been able to find an example to accomplish step (2).  

 

I would appreciate any guidance toward identifying and approach to accomplish step (2) and any recommendation to resources that will help me develop my knowledge and skills with respect to utilizing the IMAQ Vision platform for image processing and analyzing. 

 

Kind regards, 

0 Kudos
Message 1 of 6
(7,187 Views)

Hi jwtrexler,

 

To create a histrogram use IMAQ ColorHistorgram.vi

To convert the CIELAB colorspace use IMAQ RGBToColor 2.vi. Check out this forum post: https://lavag.org/topic/13885-how-to-convert-rgb-to-cie-lab/

 

Note that both of these require the Vision Development Module. 

 

I would look at the Vision Assistant. It will let you prototype an inspection and it makes it easier to figure out what the IMAQ functons do.

 

Here is the IMAQ concepts manual: http://www.ni.com/pdf/manuals/322916a.pdf

 

Regards,

Michael

Michael Bilyk
Former NI Software Engineer (IT)
0 Kudos
Message 2 of 6
(7,159 Views)

Thank you Michael.  I have been using the manual you suggested, but hoped there was something in addition that would be better to help me improve my efficiency developing a competency using IMAQ Vision.  With respect to the VI example you cited, I have tried that, but the nested loops make the program run way slower than I know Labview is capable in achieving my particular goal.  As for the Assistant, I'll try that again; having struggled for a while now, I may gain something I missed in an earlier attempt.

 

Cheers, 

0 Kudos
Message 3 of 6
(7,156 Views)

We offer classes that can help build your knowledge and abilities of the vision software: http://sine.ni.com/tacs/app/overview/p/ap/of/lang/en/pg/1/sn/n24:1324/id/1586/

 

Other than that, just looking at examples or trying to do something simpler can offer a lot of insight.

 

Michael Bilyk
Former NI Software Engineer (IT)
0 Kudos
Message 4 of 6
(7,150 Views)

I am replying to this topic again in the hope someone will be able to help with step 2 of the subject question.  In one of the replies, Michael offered a VI utilizing nested loops to convert the 32 bit array containing RGB values to Cielab Lab values.  Because of the extensive computations required for digital images of significant pixels, the cited nested loop approach requires to much computation time (i.e., approximately 30 seconds) when a steady stream of images need to be processed.  I believe there exists another Labview approach that will allow the conversion of all the pixels' from RGB coordinate color space to Lab coordinates allowing histrographs to be plotted for the respective L, a, and b distributions.  I would appreciate help from an NI engineer or anyone who is familiar with a more efficient colorspace conversion approach for all pixels of a digital image.

0 Kudos
Message 5 of 6
(7,118 Views)

Hello,

 

use OpenCV to do this.

It takes 16 ms on average to convert BGR image to Lab for image of 1024x768 pixels (IMAQ to array conversion included) - i7 CPU laptop.

 

I have attached the example, .dll and the source code. You could optimize the code even further. You need OpenCV 2.4.9 to use the .dll, or just rebuild from source with your version.

 

Hope this helps.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 6 of 6
(7,100 Views)