SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1909.09470 · 2019

Document Rectification and Illumination Correction using a Patch-based CNN

arXiv · PDF · Open in the Atlas

Code that ran

2 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1909.09470.json · badge: /api/ran/1909.09470.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xiaoyu258/DocProj community (classifier label)
classifier basis not recorded on the link
2 ran · 2 no recorded run
FunctionStatusWhere it lives
get_loader Ran
ran on a synthesized input
xiaoyu258/DocProj/train_loader.py
code served (permissive licence) · get_code("c15376b4b5eca830")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataLoader. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import numpy as np
from PIL import Image
from torchvision import transforms

# Create temporary directories with mock data
temp_dir = tempfile.mkdtemp()
patch_dir = os.path.join(temp_dir, "patches")
flow_dir = os.path.join(temp_dir, "flows")
global_dir = os.path.join(temp_dir, "globals")

os.makedirs(patch_dir, exist_ok=True)
os.makedirs(flow_dir, exist_ok=True)
os.makedirs(global_dir, exist_ok=True)

# Create mock image files (small 4x4 RGB images)
for i in range(2):
    # Create local patch images
    local_img = Image.fromarray(np.uint8(np.random.rand(4, 4, 3) * 255))
    local_img.save(os.path.join(patch_dir, f"patch_{i}.png"))
    
    # Create global images
    global_img = Image.fromarray(np.uint8(np.random.rand(4, 4, 3) * 255))
    global_img.save(os.path.join(global_dir, f"global_{i}.png"))
    
    # Create flow files (2D numpy arrays)
    flow = np.random.randn(4, 4).astype(np.float32)
    np.save(os.path.join(flow_dir, f"flow_{i}.npy"), flow)

ARGS = {
    "patch_dir": patch_dir,
    "flow_dir": flow_dir,
    "global_dir": global_dir,
    "batch_size": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, skimage, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_loader Ran
ran on a synthesized input
xiaoyu258/DocProj/train_loader_illumination.py
code served (permissive licence) · get_code("604fa1896d3244e6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataLoader. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil
import torch
import numpy as np
from PIL import Image
from torchvision import transforms
from torch.utils import data

torch.manual_seed(0)

# Create temporary directories with dummy image files
temp_dir = tempfile.mkdtemp()
distorted_dir = os.path.join(temp_dir, 'distorted')
corrected_dir = os.path.join(temp_dir, 'corrected')
os.makedirs(distorted_dir, exist_ok=True)
os.makedirs(corrected_dir, exist_ok=True)

# Create 2 dummy RGB images (4x3 pixels each for distinctness)
for i in range(2):
    # Create distorted image
    distorted_img_array = np.random.randint(0, 256, (3, 4, 3), dtype=np.uint8)
    distorted_img = Image.fromarray(distorted_img_array)
    distorted_img.save(os.path.join(distorted_dir, f'img_{i}.png'))
    
    # Create corrected image
    corrected_img_array = np.random.randint(0, 256, (3, 4, 3), dtype=np.uint8)
    corrected_img = Image.fromarray(corrected_img_array)
    corrected_img.save(os.path.join(corrected_dir, f'img_{i}.png'))

ARGS = {
    'distorted_image_dir': distorted_dir,
    'corrected_image_dir': corrected_dir,
    'batch_size': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, skimage, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
biInterpolation Not yet run
unverified (harvested, no recorded run)
xiaoyu258/DocProj/resampling.py
code served (permissive licence) · get_code("77daa09f5dff992e")
How it ran

no invocation recorded.

iterSearchShader Not yet run
unverified (harvested, no recorded run)
xiaoyu258/DocProj/resampling.py
code served (permissive licence) · get_code("34e767ccd912cb0b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We propose a novel learning method to rectify document images with various distortion types from a single input image. As opposed to previous learning-based methods, our approach seeks to first learn the distortion flow on input image patches rather than the entire image. We then present a robust technique to stitch the patch results into the rectified document by processing in the gradient domain. Furthermore, we propose a second network to correct the uneven illumination, further improving the readability and OCR accuracy. Due to the less complex distortion present on the smaller image patches, our patch-based approach followed by stitching and illumination correction can significantly improve the overall accuracy in both the synthetic and real datasets.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1909.09470")
get_code_for_paper("1909.09470")
have("1909.09470")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1909.09470.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1909.09470.svg)](https://syntology.ai/paper/1909.09470)

Connect an agent — have() is free.