This shows you the differences between two versions of the page.
jvs:cigal:manual:chapter3:analyze [2011/03/31 14:49] 127.0.0.1 external edit |
jvs:cigal:manual:chapter3:analyze [2023/02/23 18:43] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **CIGAL Reference Manual, Chapter 3 (Functions): | ||
- | ===== Analyze -- Calculate the frequency distribution of values within a variable ===== | ||
- | **usage: resultarray = analyze(ivarb)** | ||
- | |||
- | ANALYZE reads the input variable, IVARB, and creates an output array where the | ||
- | values of the array elements represent a frequency histogram of the values of | ||
- | elements in IVARB. | ||
- | elements in the array represent the frequency distribution of the possible | ||
- | values in the input. | ||
- | number of elements in the input array with value equal to 45. For inputs greater | ||
- | than 8-bits, only the low-order 12 bits are considered. | ||
- | |||
- | The array produced by ANALYZE is useful for measuring various descriptive properties | ||
- | of the input variable. | ||
- | enhancement to perform for a given image matrix, or as a way of computing the average | ||
- | value of the input. | ||
- | |||
- | Some image processing hardware is capable of performing an ANALYZE operation on an | ||
- | entire image at the hardware' | ||
- | this, and you run ANALYZE on an appropriate hardware image variable, then CIGAL | ||
- | automatically lets the hardware perform the computation. | ||
- | will do the work, but it may be a bit slow for very large variables. | ||
- | |||
- | As an example, if you have a byte matrix called VGA0, which contains a 320x184 image | ||
- | with pixel values covering the middle of the 0-255 intensity range, then the command: | ||
- | buf = analyze(vga0) | ||
- | might produce the following array BUF: | ||
- | |||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | | ||
- | 288 294 389 421 461 545 673 628 815 691 971 1022 988 1086 1257 | ||
- | 1107 1006 1171 1321 901 1084 1042 891 1133 962 949 1025 1042 1165 1038 | ||
- | 1145 1084 1245 928 960 1066 1052 786 953 855 731 762 831 842 887 | ||
- | 734 828 777 879 761 891 687 690 631 664 560 502 534 464 487 | ||
- | 457 692 683 681 729 738 490 447 341 220 147 145 130 | ||
- | | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | 0 0 0 0 0 0 0 | ||
- | | ||
- | The command STATS could then be used to describe BUF as: | ||
- | stats buf | ||
- | which tells you that the intensities in VGA0 range from 26 to 130 with the | ||
- | greatest number of pixels (1321) at intensity 63. | ||
- | |||
- | The mean pixel value can be quickly calculated from the ANALYZE array as: | ||
- | a = sum(buf) | ||
- | buf = buf * ramp(256) | ||
- | sum(buf)/ | ||
- | |||
- | The command MEAN(VGA0) would give the same result, but is generally slower. | ||
- | |||
- | **See Also:**\\ | ||
- | [[jvs: | ||
- | [[jvs: | ||
- | [[jvs: | ||
- | [[jvs: | ||
- | |||
- | [[jvs: | ||
- | [[jvs: | ||
- | [[jvs: | ||
- | [[jvs: | ||