Skip to content

gray_histo_rangeGrayHistoRangeGrayHistoRangegray_histo_rangegray_histo_range🔗

Short description🔗

gray_histo_rangeGrayHistoRangeGrayHistoRangegray_histo_rangegray_histo_range — Calculate the gray value distribution of a single channel image within a certain gray value range.

Signature🔗

gray_histo_range( region Region, image Image, real Min, real Max, integer NumBins, out histogram Histo, out real BinSize )void GrayHistoRange( const HObject& Region, const HObject& Image, const HTuple& Min, const HTuple& Max, const HTuple& NumBins, HTuple* Histo, HTuple* BinSize )static void HOperatorSet.GrayHistoRange( HObject region, HObject image, HTuple min, HTuple max, HTuple numBins, out HTuple histo, out HTuple binSize )def gray_histo_range( region: HObject, image: HObject, min: Union[float, int], max: Union[float, int], num_bins: int ) -> Tuple[Sequence[int], float]

def gray_histo_range_s( region: HObject, image: HObject, min: Union[float, int], max: Union[float, int], num_bins: int ) -> Tuple[int, float]Herror gray_histo_range( const Hobject Region, const Hobject Image, double Min, double Max, const Hlong NumBins, Hlong* Histo, double* BinSize )

Herror T_gray_histo_range( const Hobject Region, const Hobject Image, const Htuple Min, const Htuple Max, const Htuple NumBins, Htuple* Histo, Htuple* BinSize )

HTuple HImage::GrayHistoRange( const HRegion& Region, const HTuple& Min, const HTuple& Max, Hlong NumBins, double* BinSize ) const

Hlong HImage::GrayHistoRange( const HRegion& Region, double Min, double Max, Hlong NumBins, double* BinSize ) const

HTuple HRegion::GrayHistoRange( const HImage& Image, const HTuple& Min, const HTuple& Max, Hlong NumBins, double* BinSize ) const

Hlong HRegion::GrayHistoRange( const HImage& Image, double Min, double Max, Hlong NumBins, double* BinSize ) const

HTuple HImage.GrayHistoRange( HRegion region, HTuple min, HTuple max, int numBins, out double binSize )

int HImage.GrayHistoRange( HRegion region, double min, double max, int numBins, out double binSize )

HTuple HRegion.GrayHistoRange( HImage image, HTuple min, HTuple max, int numBins, out double binSize )

int HRegion.GrayHistoRange( HImage image, double min, double max, int numBins, out double binSize )

Description🔗

gray_histo_rangeGrayHistoRange calculates the gray value distribution Histohistohisto of the single channel Imageimageimage within Regionregionregion and the gray value range \([\textrm{Min},\textrm{Max}]\). The values for Minminmin and Maxmaxmax are rounded down to the next integer if the Imageimageimage is not of type 'real'"real". The gray value range is divided into NumBinsnumBinsnum_bins bins of the same size, which is returned in BinSizebinSizebin_size. If a gray value lies between two bins the gray value is assigned to the smaller bin. If the Imageimageimage is of type 'real'"real" \(\textrm{BinSize} = \frac{\textrm{Max} - \textrm{Min}}{\textrm{NumBins}}\). If the Imageimageimage has discrete gray values the size of a bin is computed with \(\textrm{BinSize} = \frac{\textrm{Max} - \textrm{Min} + 1} {\textrm{NumBins}}\). Since the accuracy of the histogram Histohistohisto can be adjusted with NumBinsnumBinsnum_bins, the calculation of the gray value histogram with gray_histo_rangeGrayHistoRange is most useful for images of type 'real'"real" and images of type 'integer'"integer", which have a high bit depth.

Attention🔗

Note that the operator gray_histo_rangeGrayHistoRange only considers the given Regionregionregion and ignores any previously set domain of the input image Imageimageimage.

If the Imageimageimage has discrete gray values the value of BinSizebinSizebin_size may cause the following effects: For BinSizebinSizebin_size \(>\) 11 multiple neighboring gray values are assigned to the same bin. If BinSizebinSizebin_size is no integer the gray values are distributed uneven among the bins, e.g., for BinSizebinSizebin_size \(=\) 1.51.5 the first and second gray value are assigned to the first bin, the third gray value is assigned to the second bin, and the fourth and fifth gray value are assigned to the third bin. This becomes noticeable in several peeks in the histogram Histohistohisto. If BinSizebinSizebin_size \(<\) 11 some classes are not assigned by any gray value, e.g., for BinSizebinSizebin_size \(=\) 0.50.5 the first gray value is assigned to the first bin and the second gray value is assigned to the third bin. The histogram Histohistohisto shows some gaps, which resembles the structure of a comb.

If the Imageimageimage is of type 'real'"real" and \(\textrm{Min} = \textrm{Max}\), all pixels of the corresponding gray value are assigned only to the first bin.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

Parameters🔗

Regionregionregion (input_object) region → objectHObjectHRegionHObjectHobject

Region in which the histogram is to be calculated.

Imageimageimage (input_object) singlechannelimage → object (byte / cyclic / direction / int1 / uint2 / int2 / int4 / int8 / real)HObject (byte / cyclic / direction / int1 / uint2 / int2 / int4 / int8 / real)HImage (byte / cyclic / direction / int1 / uint2 / int2 / int4 / int8 / real)HObject (byte / cyclic / direction / int1 / uint2 / int2 / int4 / int8 / real)Hobject (byte / cyclic / direction / int1 / uint2 / int2 / int4 / int8 / real)

Input image.

Minminmin (input_control) real → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum gray value.

Default: 00
Suggested values: 00

Maxmaxmax (input_control) real → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum gray value.

Default: 255255
Suggested values: 255255
Restriction: Max >= Min

NumBinsnumBinsnum_bins (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of bins.

Default: 256256
Suggested values: 16, 32, 64, 128, 25616, 32, 64, 128, 256
Restriction: NumBins >= 1

Histohistohisto (output_control) histogram(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Histogram to be calculated.

BinSizebinSizebin_size (output_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Bin size.

Result🔗

If the parameters are valid, the operator gray_histo_rangeGrayHistoRange returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

min_max_grayMinMaxGray

Possible successors

create_funct_1d_arrayCreateFunct1dArray

Alternatives

gray_histoGrayHisto, gray_histo_absGrayHistoAbs

See also

histo_2dimHisto2dim, scale_image_maxScaleImageMax

Module🔗

Foundation