Skip to content

[Standard]: AREA algorithm not correctly denoted in norm #417

@LarsKooijman

Description

@LarsKooijman

Member Body/National Committee

AS ISO/IEC 29794.4:2025

Clause/Subclause

6.2.13.3

Paragraph/Figure/Table

No response

Type of Comment

General

Comments

The norm stipulates that for each local region V in I, we check if V has at least 1 pixel in the foreground R to mark the local region a foreground and compute the arithmetic mean of the grey levels of all pixels in the set of local regions V that were marked as foreground. Thus, this should include non-foreground pixels (i.e., white 255) as V operates in a block-wise manner.

However, in the code ImgProcROI.cpp the mean of the area of the region of interest is computed by summing the gray value of the ROI pixel and dividing it by the number of ROI pixels. At no point are non-ROI pixels included.

Also, a clause is added in the code that the "mean area value" is rated as 255 for a white image that does not contain ROI pixels, which is not noted in the norm either.

// count ROI pixels ( = black pixels)
	// and get mean value of ROI pixels
	unsigned int noOfROIPixels = 0;
	double meanOfROIPixels = 0.0;
	for (int i = 0; i < threshImg2.rows; i++) {
		for (int j = 0; j < threshImg2.cols; j++) {
			if (((int)threshImg2.at<uchar>(i, j)) == 0) {
				noOfROIPixels++;
				// get gray value of original image (0 = black,
				// 255 = white)
				meanOfROIPixels += (int)img.at<uchar>(i, j);
			}
		}
	}
// divide value by absolute number of ROI pixels to get mean
	if (noOfROIPixels <= 0) {
		meanOfROIPixels = 255.0; // "white" image
	} else {
		meanOfROIPixels = (meanOfROIPixels / (double)noOfROIPixels);
	}

.....

roiResults.chosenBlockSize = bs;
	roiResults.noOfAllBlocks = noOfAllBlocks;
	roiResults.noOfCompleteBlocks = noOfCompleteBlocks;
	roiResults.noOfImagePixels = (img.cols * img.rows);
	roiResults.noOfROIPixels = noOfROIPixels;
	roiResults.meanOfROIPixels = meanOfROIPixels;
	roiResults.stdDevOfROIPixels = stdDevOfROIPixels;

	return roiResults;

Proposed Change

If we want the norm to always work in 32x32 blocks, then the code needs to be refactored to suit this process.

Metadata

Metadata

Assignees

Labels

standardText updates to ISO/IEC 29794-4:2024

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions