403Webshell
Server IP : 217.154.3.148  /  Your IP : 216.73.216.90
Web Server : Apache
System : Linux blissful-wright.217-154-3-148.plesk.page 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : gracious-boyd_hfhh1h8vo9n ( 10000)
PHP Version : 8.3.31
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/gracious-boyd.217-154-3-148.plesk.page/nextjs/lib/analyzers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/gracious-boyd.217-154-3-148.plesk.page/nextjs/lib/analyzers/index.ts
import { analyzeFFTPeriod } from './fft_period';
import { analyzeHoughGrid } from './hough_grid';
import { gradientFromGray, confidenceByLines } from './score';

export type PeriodicResult = {
  ok: true;
  tile_w_px: number;
  tile_h_px: number;
  grout_px: number;
  vlines: number[];
  hlines: number[];
  source: string;
  periodX: number;
  periodY: number;
  phaseX: number;
  phaseY: number;
  confidence: number;
  thetaV?: number;
  thetaH?: number;
};
export type PeriodicErr = { ok:false; error:string };

type PeriodicOpts = {
  debug?: boolean;
  weights?: Float32Array | null;
};

export function runPeriodicAnalysis(
  gray: Float32Array,
  w: number,
  h: number,
  opts?: PeriodicOpts
): PeriodicResult | PeriodicErr {
  if (!Number.isFinite(w)||!Number.isFinite(h)||w<8||h<8) return { ok:false, error:'invalid image size' };

  // Gradienten einmal berechnen (für Confidence)
  const { gx, gy } = gradientFromGray(gray, w, h, opts?.weights ?? null);

  // 1) FFT-Analyse
  const fft = analyzeFFTPeriod(gray, w, h, { debug: opts?.debug, weights: opts?.weights ?? undefined });
  let best: PeriodicResult | null = null;

  if (fft.ok) {
    const grout = (fft as any).groutPx ?? (fft as any).grout ?? 1;
    const tile_w_px = Math.max(1, Math.round(fft.periodX - grout));
    const tile_h_px = Math.max(1, Math.round(fft.periodY - grout));
    const conf = confidenceByLines(fft.vlines, fft.hlines, gx, gy, w, h);
    best = {
      ok: true,
      tile_w_px, tile_h_px,
      grout_px: Math.max(1, Math.round(grout)),
      vlines: fft.vlines, hlines: fft.hlines,
      source: 'cv@fft-welch',
      periodX: fft.periodX, periodY: fft.periodY,
      phaseX: fft.phaseX,   phaseY: fft.phaseY,
      confidence: conf,
      thetaV: 0,   // FFT kennt Orientierung nicht → 0°/90° annehmen
      thetaH: Math.PI/2
    };
  }

  // 2) Falls keine FFT oder zu schwach → Hough testen
  let needHough = !best || best.confidence < 0.35;
  let hbest: PeriodicResult | null = null;

  if (needHough) {
    const hg = analyzeHoughGrid(gray, w, h, { debug: opts?.debug, weights: opts?.weights ?? undefined });
    if (hg.ok) {
      const grout = Math.max(1, Math.round(hg.groutPx));
      const tile_w_px = Math.max(1, Math.round(hg.periodX - grout));
      const tile_h_px = Math.max(1, Math.round(hg.periodY - grout));
      const conf = confidenceByLines(hg.vlines, hg.hlines, gx, gy, w, h);
      hbest = {
        ok: true,
        tile_w_px, tile_h_px,
        grout_px: grout,
        vlines: hg.vlines, hlines: hg.hlines,
        source: 'cv@hough-grid',
        periodX: hg.periodX, periodY: hg.periodY,
        phaseX: hg.phaseX,   phaseY: hg.phaseY,
        confidence: conf,
        thetaV: hg.thetaV, thetaH: hg.thetaH
      };
    }
  }

  // 3) Beste Variante wählen
  if (best && hbest) {
    return best.confidence >= hbest.confidence ? best : hbest;
  }
  if (best) return best;
  if (hbest) return hbest;

  // beide fehlgeschlagen
  const reason = (fft as any)?.reason || 'fft-fail';
  return { ok:false, error: `${reason}; hough-fail` };
}

Youez - 2016 - github.com/yon3zu
LinuXploit