hx_cooc_feature — 2D halcon_ext op

• Data kinds: image → feature

• Call: fullseye.apply(img, "hx_cooc_feature", a=0.5, b=0.5) (the 2-D model is one image plus two scalar knobs a,b∈[0,1])

• HALCON equivalent: cooc_feature_image (the HALCON reference is a useful guide to its meaning and parameters)

hx_cooc_feature: input → output

*The figure is the actual output on a synthetic 128×128 input. Left: input, right: output. Point clouds are drawn as a top-down scatter (brightness = z), 1-D series as a line plot, volumes as the maximum-intensity projection along z, videos as the middle frame, complex images as magnitude; return values that are not pictures are shown as the values themselves.*

Sweeping knob a (0.1 / 0.5 / 0.9, the other knob at its default):

▸ hx_cooc_feature: knob a sweep (docs site)

Sweeping knob b (0.1 / 0.5 / 0.9, the other knob at its default):

▸ hx_cooc_feature: knob b sweep (docs site)

Usage

Quantise, build the horizontal co-occurrence matrix at distance d, and return the Haralick contrast (a = distance, b selects the angle).

Quantizes the input v ([0,1] image) to 8 grey levels with int(v*8) (clipped to 0 to 7), builds an 8×8 co-occurrence matrix of the occurrence counts of pixel pairs separated by distance d, adds its transpose (symmetrisation), and divides by the total to get probabilities. It returns Haralick's contrast sum p(i,j)*(i-j)^2 divided by its maximum (8-1)^2 = 49 as np.float64 (range [0,1]).

• a → distance d = 1 + int(a*3) (1 to 4 pixels).

• b → direction. b < 0.5 horizontal (d columns to the right in the same row), b >= 0.5 vertical (d rows down in the same column). There are no diagonal directions.

• If the image width (or height) is d or less and not even 1 pixel pair can be formed, the total is treated as 0 and 0.0 is returned (no exception is raised).

The larger the value, the larger the grey-level difference between neighbouring pixels (coarse/high-contrast texture). With 8 grey levels, subtle tone differences collapse into the same level. Grey-level count and normalisation differ from the 16-level skimage implementation cooc_feature_matrix, so the values do not match. Upstream, image ops such as hx_gabor or mean_image; downstream, use it as a feature for comparison and thresholding.

Detailed usage guide

• gallery2d_halcon_ext family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Try it in Studio

The program below has been verified to run (same input as the figure). In Studio's help this block becomes buttons that load and run it on the spot.

hx_cooc_feature 0.50 0.50

▸ Load this pipeline  ·  Load & run

Runnable examples (verified samples that actually call this op)

• gallery2d_halcon_ext — py -3.11 examples/gallery2d_halcon_ext.py

Ops the type connects to (they accept feature as input)

identity · feature_to_img

Same category (halcon_ext)

hx_gen_circle · hx_gen_ellipse · hx_gen_rectangle2 · hx_gen_checker_region · hx_gen_grid_region · hx_gabor · hx_fit_surface1 · hx_fit_surface2


*Provenance: ops.py — 2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.