HALCON Reference Manual 10.0.2
Table of Contents / Filters / Texture ClassesClassesClasses | | | Operators

texture_lawstexture_lawstexture_lawsTextureLawsTextureLaws (Operator)

Name

texture_lawstexture_lawstexture_lawsTextureLawsTextureLaws — Filter an image using a Laws texture filter.

Signature

texture_laws(Image : ImageTexture : FilterTypes, Shift, FilterSize : )

Herror texture_laws(const Hobject Image, Hobject* ImageTexture, const char* FilterTypes, const Hlong Shift, const Hlong FilterSize)

Herror T_texture_laws(const Hobject Image, Hobject* ImageTexture, const Htuple FilterTypes, const Htuple Shift, const Htuple FilterSize)

Herror texture_laws(Hobject Image, Hobject* ImageTexture, const HTuple& FilterTypes, const HTuple& Shift, const HTuple& FilterSize)

HImage HImage::TextureLaws(const HTuple& FilterTypes, const HTuple& Shift, const HTuple& FilterSize) const

HImageArray HImageArray::TextureLaws(const HTuple& FilterTypes, const HTuple& Shift, const HTuple& FilterSize) const

void HOperatorSetX.TextureLaws(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ImageTexture, [in] VARIANT FilterTypes, [in] VARIANT Shift, [in] VARIANT FilterSize)

IHImageX* HImageX.TextureLaws(
[in] BSTR FilterTypes, [in] Hlong Shift, [in] Hlong FilterSize)

static void HOperatorSet.TextureLaws(HObject image, out HObject imageTexture, HTuple filterTypes, HTuple shift, HTuple filterSize)

HImage HImage.TextureLaws(string filterTypes, int shift, int filterSize)

Description

texture_lawstexture_lawstexture_lawsTextureLawsTextureLaws applies a texture transformations (according to Laws) to an image. This is done by convolving the input image with a special filter mask. The filters are:

9 different 3x3 matrices obtainable from the following three vectors:

    l      =       [  1     2       1  ],
    e      =       [ -1     0       1  ],
    s      =       [ -1     2      -1  ]

25 different 5x5 matrices obtainable from the following five vectors:

    l      =       [  1     4       6       4       1 ],
    e      =       [ -1    -2       0       2       1 ],
    s      =       [ -1     0       2       0      -1 ],
    r      =       [  1    -4       6      -4       1 ],
    w      =       [ -1     2       0      -2       1 ]

36 different 7x7 matrices obtainable from the following six vectors:

    l      =       [  1     6      15      20      15      6      1  ],
    e      =       [ -1    -4      -5       0       5      4      1  ],
    s      =       [ -1    -2       1       4       1     -2     -1  ],
    r      =       [ -1    -2      -1       4      -1     -2      1  ],
    w      =       [ -1     0       3       0      -3      0      1  ],
    o      =       [ -1     6     -15      20     -15      6     -1  ]

For most of the filters the resulting gray values must be modified by a ShiftShiftShiftShiftshift. This makes the different textures in the output image more comparable to each other, provided suitable filters are used.

The name of the filter is composed of the letters of the two vectors used, where the first letter denotes convolution in the column direction while the second letter denotes convolution in the row direction.

Attention

texture_lawstexture_lawstexture_lawsTextureLawsTextureLaws can be executed on OpenCL devices.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject (byte* / int2* / uint2*) *allowed for compute devices

Images to which the texture transformation is to be applied.

ImageTextureImageTextureImageTextureImageTextureimageTexture (output_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject * (byte / int2 / uint2)

Texture images.

FilterTypesFilterTypesFilterTypesFilterTypesfilterTypes (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Desired filters (name or number).

Default value: 'el' "el" "el" "el" "el"

Suggested values: 'll'"ll""ll""ll""ll", 'le'"le""le""le""le", 'ls'"ls""ls""ls""ls", 'lr'"lr""lr""lr""lr", 'lw'"lw""lw""lw""lw", 'lo'"lo""lo""lo""lo", 'el'"el""el""el""el", 'ee'"ee""ee""ee""ee", 'es'"es""es""es""es", 'er'"er""er""er""er", 'ew'"ew""ew""ew""ew", 'eo'"eo""eo""eo""eo", 'sl'"sl""sl""sl""sl", 'se'"se""se""se""se", 'ss'"ss""ss""ss""ss", 'sr'"sr""sr""sr""sr", 'sw'"sw""sw""sw""sw", 'so'"so""so""so""so", 'rl'"rl""rl""rl""rl", 're'"re""re""re""re", 'rs'"rs""rs""rs""rs", 'rr'"rr""rr""rr""rr", 'rw'"rw""rw""rw""rw", 'ro'"ro""ro""ro""ro", 'wl'"wl""wl""wl""wl", 'we'"we""we""we""we", 'ws'"ws""ws""ws""ws", 'wr'"wr""wr""wr""wr", 'ww'"ww""ww""ww""ww", 'wo'"wo""wo""wo""wo", 'ol'"ol""ol""ol""ol", 'oe'"oe""oe""oe""oe", 'os'"os""os""os""os", 'or'"or""or""or""or", 'ow'"ow""ow""ow""ow", 'oo'"oo""oo""oo""oo"

ShiftShiftShiftShiftshift (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Shift to reduce the gray value dynamics.

Default value: 2

List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

FilterSizeFilterSizeFilterSizeFilterSizefilterSize (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Size of the filter kernel.

Default value: 5

List of values: 3, 5, 7

Example (HDevelop)

* Two-dimensional pixel classification
read_image(Image,'combine')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
texture_laws(Image,Texture1,'es',2,5)
texture_laws(Image,Texture2,'le',2,5)
mean_image(Texture1,H1,51,51)
mean_image(Texture2,H2,51,51)
fwrite_string(FileId,'mark desired image section')
fnew_line(FileId)
set_color(WindowHandle,'green')
draw_region(Region,WindowHandle)
reduce_domain(H1,Region,Foreground1)
reduce_domain(H2,Region,Foreground2)
histo_2dim(Region,Foreground1,Foreground2,Histo)
threshold(Histo,Characteristic_area,1,1000000)
set_color(WindowHandle,'blue')
disp_region(Characteristic_area,WindowHandle)
class_2dim_sup(H1,H2,Characteristic_area,Seg)
set_color(WindowHandle,'red')
disp_region(Seg,WindowHandle)

Example (C)

/* Two-dimensional pixel classification */
read_image(&Image,"combine");
open_window(0,0,-1,-1,"root","visible","",&WindowHandle);
disp_image(Image,WindowHandle);
texture_laws(Image,&Texture1,"es",2,5);
texture_laws(Image,&Texture2,"le",2,5);
mean_image(Texture1,&H1,51,51);
mean_image(Texture2,&H2,51,51);
fwrite_string(FileId,"mark desired image section");
fnew_line(FileId);
set_color(WindowHandle,"green");
draw_region(&Region,WindowHandle);
reduce_domain(H1,Region,&Foreground1);
reduce_domain(H2,Region&,Foreground2);
histo_2dim(Region,Foreground1,Foreground2,&Histo);
threshold(Histo,&Characteristic_area,1.0,1000000.0);
set_color(WindowHandle,"blue");
disp_region(Characteristic_area,WindowHandle);
class_2dim_sup(H1,H2,Characteristic_area,&Seg);
set_color(WindowHandle,"red");
disp_region(Seg,WindowHandle);

Example (HDevelop)

* Two-dimensional pixel classification
read_image(Image,'combine')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
texture_laws(Image,Texture1,'es',2,5)
texture_laws(Image,Texture2,'le',2,5)
mean_image(Texture1,H1,51,51)
mean_image(Texture2,H2,51,51)
fwrite_string(FileId,'mark desired image section')
fnew_line(FileId)
set_color(WindowHandle,'green')
draw_region(Region,WindowHandle)
reduce_domain(H1,Region,Foreground1)
reduce_domain(H2,Region,Foreground2)
histo_2dim(Region,Foreground1,Foreground2,Histo)
threshold(Histo,Characteristic_area,1,1000000)
set_color(WindowHandle,'blue')
disp_region(Characteristic_area,WindowHandle)
class_2dim_sup(H1,H2,Characteristic_area,Seg)
set_color(WindowHandle,'red')
disp_region(Seg,WindowHandle)

Example (HDevelop)

* Two-dimensional pixel classification
read_image(Image,'combine')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
texture_laws(Image,Texture1,'es',2,5)
texture_laws(Image,Texture2,'le',2,5)
mean_image(Texture1,H1,51,51)
mean_image(Texture2,H2,51,51)
fwrite_string(FileId,'mark desired image section')
fnew_line(FileId)
set_color(WindowHandle,'green')
draw_region(Region,WindowHandle)
reduce_domain(H1,Region,Foreground1)
reduce_domain(H2,Region,Foreground2)
histo_2dim(Region,Foreground1,Foreground2,Histo)
threshold(Histo,Characteristic_area,1,1000000)
set_color(WindowHandle,'blue')
disp_region(Characteristic_area,WindowHandle)
class_2dim_sup(H1,H2,Characteristic_area,Seg)
set_color(WindowHandle,'red')
disp_region(Seg,WindowHandle)

Example (HDevelop)

* Two-dimensional pixel classification
read_image(Image,'combine')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
texture_laws(Image,Texture1,'es',2,5)
texture_laws(Image,Texture2,'le',2,5)
mean_image(Texture1,H1,51,51)
mean_image(Texture2,H2,51,51)
fwrite_string(FileId,'mark desired image section')
fnew_line(FileId)
set_color(WindowHandle,'green')
draw_region(Region,WindowHandle)
reduce_domain(H1,Region,Foreground1)
reduce_domain(H2,Region,Foreground2)
histo_2dim(Region,Foreground1,Foreground2,Histo)
threshold(Histo,Characteristic_area,1,1000000)
set_color(WindowHandle,'blue')
disp_region(Characteristic_area,WindowHandle)
class_2dim_sup(H1,H2,Characteristic_area,Seg)
set_color(WindowHandle,'red')
disp_region(Seg,WindowHandle)

Result

texture_lawstexture_lawstexture_lawsTextureLawsTextureLaws returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behaviour can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Successors

mean_imagemean_imagemean_imageMeanImageMeanImage, binomial_filterbinomial_filterbinomial_filterBinomialFilterBinomialFilter, gauss_imagegauss_imagegauss_imageGaussImageGaussImage, median_imagemedian_imagemedian_imageMedianImageMedianImage, histo_2dimhisto_2dimhisto_2dimHisto2dimHisto2dim, learn_ndim_normlearn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNorm, learn_ndim_boxlearn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBox, thresholdthresholdthresholdThresholdThreshold

Alternatives

convol_imageconvol_imageconvol_imageConvolImageConvolImage

See also

class_2dim_supclass_2dim_supclass_2dim_supClass2dimSupClass2dimSup, class_ndim_normclass_ndim_normclass_ndim_normClassNdimNormClassNdimNorm

References

Laws, K.I. “Textured image segmentation”; Ph.D. dissertation, Dept. of Engineering, Univ. Southern California, 1980

Module

Foundation


Table of Contents / Filters / Texture ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH