Commit 043c237b for tesseract
commit 043c237ba0027aa836be7a94813dfbded8e24bb1
Author: Stefan Weil <sw@weilnetz.de>
Date: Sat Dec 5 17:56:36 2026 +0100
Fix typos in variable names
Rename "npixes" to "npixels" in imagefind.cpp and "pixes" to "pixels"
in networkio.cpp/h (local variable and parameter of FromPixes). The
FromPixes function name itself is unchanged to avoid a public API
change; it will be renamed with the next major release.
Assisted-by: OpenCode / Qwen4-35B-A3B (Alibaba Cloud)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/lstm/networkio.cpp b/src/lstm/networkio.cpp
index 602865e5..dbab70c6 100644
--- a/src/lstm/networkio.cpp
+++ b/src/lstm/networkio.cpp
@@ -161,19 +161,19 @@ static void ComputeBlackWhite(Image pix, float *black, float *white) {
// If the image width doesn't match the shape, the image is truncated or padded
// with noise to match.
void NetworkIO::FromPix(const StaticShape &shape, const Image pix, TRand *randomizer) {
- std::vector<Image> pixes(1, pix);
- FromPixes(shape, pixes, randomizer);
+ std::vector<Image> pixels(1, pix);
+ FromPixes(shape, pixels, randomizer);
}
// Sets up the array from the given set of images, using the currently set
// int_mode_. If the image width doesn't match the shape, the images are
// truncated or padded with noise to match.
-void NetworkIO::FromPixes(const StaticShape &shape, const std::vector<Image> &pixes,
+void NetworkIO::FromPixes(const StaticShape &shape, const std::vector<Image> &pixels,
TRand *randomizer) {
int target_height = shape.height();
int target_width = shape.width();
std::vector<std::pair<int, int>> h_w_pairs;
- for (auto &&pix : pixes) {
+ for (auto &&pix : pixels) {
Image var_pix = pix;
int width = pixGetWidth(var_pix);
if (target_width != 0) {
@@ -188,8 +188,8 @@ void NetworkIO::FromPixes(const StaticShape &shape, const std::vector<Image> &pi
stride_map_.SetStride(h_w_pairs);
ResizeToMap(int_mode(), stride_map_, shape.depth());
// Iterate over the images again to copy the data.
- for (size_t b = 0; b < pixes.size(); ++b) {
- Image pix = pixes[b];
+ for (size_t b = 0; b < pixels.size(); ++b) {
+ Image pix = pixels[b];
float black = 0.0f, white = 255.0f;
if (shape.depth() != 3) {
ComputeBlackWhite(pix, &black, &white);
diff --git a/src/lstm/networkio.h b/src/lstm/networkio.h
index a5e7a80b..a7981c89 100644
--- a/src/lstm/networkio.h
+++ b/src/lstm/networkio.h
@@ -70,7 +70,7 @@ public:
// Sets up the array from the given set of images, using the currently set
// int_mode_. If the image width doesn't match the shape, the images are
// truncated or padded with noise to match.
- void FromPixes(const StaticShape &shape, const std::vector<Image> &pixes,
+ void FromPixes(const StaticShape &shape, const std::vector<Image> &pixels,
TRand *randomizer);
// Copies the given pix to *this at the given batch index, stretching and
// clipping the pixel values so that [black, black + 2*contrast] maps to the
diff --git a/src/textord/imagefind.cpp b/src/textord/imagefind.cpp
index 6cea744d..4e62ca6e 100644
--- a/src/textord/imagefind.cpp
+++ b/src/textord/imagefind.cpp
@@ -220,13 +220,13 @@ static void ConnCompAndRectangularize(Image pix, DebugPixa *pixa_debug,
// Rectangularize the individual images. If a sharp edge in vertical and/or
// horizontal occupancy can be found, it indicates a probably rectangular
// image with unwanted bits merged on, so clip to the approximate rectangle.
- int npixes = 0;
+ int npixels = 0;
if (*boxa != nullptr && *pixa != nullptr) {
- npixes = pixaGetCount(*pixa);
+ npixels = pixaGetCount(*pixa);
*mask_boxa = boxaCopy(*boxa, L_COPY);
*mask_pixa = pixaCopy(*pixa, L_COPY_CLONE);
}
- for (int i = 0; i < npixes; ++i) {
+ for (int i = 0; i < npixels; ++i) {
int x_start, x_end, y_start, y_end;
Image img_pix = pixaGetPix(*pixa, i, L_CLONE);
if (textord_tabfind_show_images && pixa_debug != nullptr) {