<commit_before>package org.genericsystem.cv.application;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.analysis.function.Constant;
import org.apache.commons.math3.analysis.function.Identity;
import org.apache.commons.math3.analysis.function.Minus;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.analysis.solvers.BisectionSolver;
import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
import org.genericsystem.cv.Svd;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Point3;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

public class MeshGridRadon extends MeshGrid {

	private static final Logger logger = LoggerFactory.getLogger(MeshGridRadon.class);

	// Array of points: top left, top right, bottom right, bottom left.
	private List<Point3> points3D;
	private Map<Key, Point3[]> mesh3D;
	private final int xStep;
	private final int yStep;
	private final int nVerts;
	private final int nLines;

	public MeshGridRadon(int border, int xStep, int yStep, Mat image) {
		super(image, border, border);
		this.xStep = xStep;
		this.yStep = yStep;
		nLines = (image.height() - 1) / yStep + 1;
		nVerts = (image.width() - 1) / xStep + 1;
	}

	private int[][] toRectIndices() {
		int[][] rects = new int[mesh.size()][4];
		List<Point[]> meshPoints = new ArrayList<>(mesh.values());<commit_msg>MeshGridRadon: Take borders into account when computing number of lines<commit_after>package org.genericsystem.cv.application;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.analysis.function.Constant;
import org.apache.commons.math3.analysis.function.Identity;
import org.apache.commons.math3.analysis.function.Minus;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.analysis.solvers.BisectionSolver;
import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
import org.genericsystem.cv.Svd;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Point3;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

public class MeshGridRadon extends MeshGrid {

	private static final Logger logger = LoggerFactory.getLogger(MeshGridRadon.class);

	// Array of points: top left, top right, bottom right, bottom left.
	private List<Point3> points3D;
	private Map<Key, Point3[]> mesh3D;
	private final int xStep;
	private final int yStep;
	private final int nVerts;
	private final int nLines;

	public MeshGridRadon(int border, int xStep, int yStep, Mat image) {
		super(image, border, border);
		this.xStep = xStep;
		this.yStep = yStep;
		// Use this.image to take the borders into account.
		nLines = (this.image.height() - 1) / yStep + 1;
		nVerts = (this.image.width() - 1) / xStep + 1;
	}

	private int[][] toRectIndices() {
		int[][] rects = new int[mesh.size()][4];
		List<Point[]> meshPoints = new ArrayList<>(mesh.values());
{'fraction_non_alphanumeric': 0.11729979466119096, 'fraction_numerical': 0.01026694045174538, 'mean_word_length': 5.27536231884058, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4265547', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1305, 'n_words': 288}