Example Code

Gray level co-occurrence matrix

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example shows how to find gray level co-occurrence matrix from pixel value input array.


Description

There are 3 vis inside this example:

 1. glcm_main.vi which finds the maximum pixel value to initialize gray level co-occurrence matrix array (glcm). Then, it extracts each pixel value inside array, together with right and below pixel value. The extracted values are used for determining which row and column inside glcm needs an increment.

2. cell_value.vi which extracts the pixel value to the right of and underneath the current cell. If an index is invalid, it outputs -1.

3. update_array.vi which increments the value in the glcm according to its input row and column. If row or column is equal to -1 (implying that there is an invalid index), it'll just pass the input array to the output array.


 

Requirements: LabVIEW 2012 (or compatible). Hardware: None.


Steps to Execute Code:

1. Download and extract files from glcm_main.zip.

2. Open glcm_main.vi.

3. Insert your input array to the Array front panel control.

4. Run the VI.

5. The glcm front panel array will contain the GLCM of your input array.


Additional Information or References: 

 

Gray level co-occurrence matrix FP.png

 

Gray level co-occurrence matrix BD.png


**This document has been updated to meet the current required format for the NI Code Exchange.** 

 

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Nardimes
Member
Member
on

in my project glcm is used to extract texture feature an image