LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pixel color value of HSV

Im trying to get a single pixel color value of HSV starting on the x0 y0 coordinates from my picture, x1 y0, x2 y0, ... at the rows and then continue to columns. Where would i get the frequency of each color (0-255) on the whole picture at the table with one column for H => 0-255, S => 0-255 and V=> 0-255. But i need the frequency so i only need to add +1 everytime it appearce in there for each color to count it at the end (i need it for fuzzy later, to show my fruit has a good color and is ready to be harvested).

Could you please help me with that?

0 Kudos
Message 1 of 4
(2,590 Views)

Hi Lise,

 

what is the data source? I guess you read some images using the PictureFile functions…

 


@WonderLise wrote:

i need the frequency so i only need to add +1 everytime it appearce in there for each color to count it at the end

Could you please help me with that?


  • The math to convert from RGB to HSV is quite simple, you can read about that on Wikipedia (and other sources). Implement that math as subVI…
  • Apply that subVI on each pixel RGB color value.
  • Create a histogramm for all H values calculated by your subVI: LabVIEW comes with ready-to-use Histogram functions.

Simple steps: try on your own. When you get into trouble you should attach your VI(s) and ask for specific help.

Best regards,
GerdW


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

Are you using NIVision? Or are you working on pixmaps?

 

NIVision has conversion VIs to convert from RGB to HSV (or was it HSL?). Once you converted, you can use the thresholding function(s) to mask all 'frequencies'. After that, you can use object detection functions to do the grouping of objects, or get all pixels as an array and add them. Or use a histogram on the HSx image.

 

Keep in mind that H will wrap around 0. IIRC, red will be centered around 0, so one threshold might not suffice. If the range is 20, correct thresholding might be 0-10 OR 245-255. All from the top of my head, so check the details (for instance, max H might not be 255).

0 Kudos
Message 3 of 4
(2,570 Views)

Im using Vision, i can show you, even tho its really simple for now.

 

Thank you, for you reply, i will keep the threshol in mind.

0 Kudos
Message 4 of 4
(2,562 Views)