-
Notifications
You must be signed in to change notification settings - Fork 0
feat(inpaint): TextSeg-guided two-pass inpainting with pixel-accurate erasure #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,10 @@ | |
| <PackageReference Include="LibNMeCab.IpaDicBin" Version="0.10.*" /> | ||
| <PackageReference Include="SkiaSharp" Version="3.119.4" /> | ||
| <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.4" /> | ||
| <PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" /> | ||
| <PackageReference Include="OpenCvSharp4.official.runtime.linux-x64" Version="4.13.0.20260627" /> | ||
|
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Check published OpenCvSharp package versions and find usage in the repository.
set -uo pipefail
for pkg in opencvsharp4 opencvsharp4.official.runtime.linux-x64; do
echo "=== $pkg ==="
curl -s "https://api.nuget.org/v3-flatcontainer/${pkg}/index.json" | jq -r '.versions[-15:][]'
done
# Where is OpenCV actually used?
rg -n --type=cs -C3 'OpenCvSharp|Cv2\.'Repository: deckyfx/web-ocr Length of output: 702 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== project file ==="
cat -n server/server-csharp.csproj | sed -n '25,45p'
echo "=== C# files and OpenCvSharp references ==="
git ls-files '*.cs' | while IFS= read -r f; do
if rg -n -C3 'OpenCvSharp|Cv2\.' "$f"; then
:
fi
done
echo "=== package metadata ==="
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
for spec in \
"opencvsharp4/4.10.0.20241108" \
"opencvsharp4/4.13.0.20260627" \
"opencvsharp4.official.runtime.linux-x64/4.13.0.20260627"
do
pkg="${spec%/*}"
ver="${spec#*/}"
url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nupkg"
out="$tmpdir/${pkg}.${ver}.nupkg"
echo "--- $pkg $ver ---"
curl -fsSL "$url" -o "$out"
unzip -l "$out" | sed -n '1,80p'
unzip -p "$out" '*.nuspec' | sed -n '1,160p'
doneRepository: deckyfx/web-ocr Length of output: 13863 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== target framework and runtime identifiers ==="
cat -n server/server-csharp.csproj | sed -n '1,28p'
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
download_pkg() {
local pkg="$1" ver="$2"
local lower_pkg="${pkg,,}"
local out="$tmpdir/${lower_pkg}.${ver}.nupkg"
curl -fsSL "https://api.nuget.org/v3-flatcontainer/${lower_pkg}/${ver}/${lower_pkg}.${ver}.nupkg" -o "$out"
mkdir -p "$tmpdir/${lower_pkg}.${ver}"
unzip -q "$out" -d "$tmpdir/${lower_pkg}.${ver}"
}
echo "=== available 4.10 runtime versions ==="
curl -fsSL 'https://api.nuget.org/v3-flatcontainer/opencvsharp4.official.runtime.linux-x64/index.json' |
jq -r '.versions[]' | grep '^4\.10\.'
download_pkg 'OpenCvSharp4.official.runtime.linux-x64' '4.10.0.20241108'
download_pkg 'OpenCvSharp4.official.runtime.linux-x64' '4.13.0.20260627'
echo "=== native library exports: matching 4.10 versus selected 4.13 ==="
for f in \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.10.0.20241108/runtimes/linux-x64/native/libOpenCvSharpExtern.so \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.13.0.20260627/runtimes/linux-x64/native/libOpenCvSharpExtern.so
do
echo "--- $f ---"
file "$f"
nm -D --defined-only "$f" | awk '{print $3}' | sort > "$f.exports"
echo "export count: $(wc -l < "$f.exports")"
done
comm -3 \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.10.0.20241108/runtimes/linux-x64/native/libOpenCvSharpExtern.so.exports \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.13.0.20260627/runtimes/linux-x64/native/libOpenCvSharpExtern.so.exports |
sed -n '1,120p'
echo "=== symbols used by the 4.10 managed assembly for this code path ==="
download_pkg 'OpenCvSharp4' '4.10.0.20241108'
strings "$tmpdir"/opencvsharp4.4.10.0.20241108/lib/net6.0/OpenCvSharp.dll |
grep -E 'core_.*(imdecode|rectangle|inpaint|imencode|countNonZero|dilate|getStructuringElement)|OpenCvSharpExtern' |
sort -uRepository: deckyfx/web-ocr Length of output: 2033 🏁 Script executed: #!/bin/bash
set -u
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
download_pkg() {
local pkg="$1" ver="$2"
local lower_pkg="${pkg,,}"
local out="$tmpdir/${lower_pkg}.${ver}.nupkg"
curl -fsSL "https://api.nuget.org/v3-flatcontainer/${lower_pkg}/${ver}/${lower_pkg}.${ver}.nupkg" -o "$out" || return 1
mkdir -p "$tmpdir/${lower_pkg}.${ver}"
unzip -q "$out" -d "$tmpdir/${lower_pkg}.${ver}" || return 1
}
download_pkg 'OpenCvSharp4.official.runtime.linux-x64' '4.10.0.20241108'
download_pkg 'OpenCvSharp4.official.runtime.linux-x64' '4.13.0.20260627'
download_pkg 'OpenCvSharp4' '4.10.0.20241108'
echo "=== native export comparison ==="
for ver in 4.10.0.20241108 4.13.0.20260627; do
f="$tmpdir/opencvsharp4.official.runtime.linux-x64.$ver/runtimes/linux-x64/native/libOpenCvSharpExtern.so"
echo "--- $ver ---"
if command -v nm >/dev/null 2>&1; then
nm -D --defined-only "$f" | awk '{print $3}' | sort -u > "$tmpdir/$ver.exports"
else
readelf -Ws "$f" | awk '$4 == "FUNC" && $7 != "UND" {print $8}' | sort -u > "$tmpdir/$ver.exports"
fi
wc -l "$tmpdir/$ver.exports"
done
echo "--- symbols only in one version (first 160) ---"
comm -3 "$tmpdir/4.10.0.20241108.exports" "$tmpdir/4.13.0.20260627.exports" | sed -n '1,160p'
echo "=== managed wrapper strings relevant to the repository call path ==="
strings "$tmpdir/opencvsharp4.4.10.0.20241108/lib/net6.0/OpenCvSharp.dll" |
grep -Ei 'OpenCvSharpExtern|inpaint|imdecode|imencode|rectangle|countnonzero|dilate|getstructuringelement' |
sort -u | sed -n '1,160p'Repository: deckyfx/web-ocr Length of output: 4029 🏁 Script executed: #!/bin/bash
set -u
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
download_pkg() {
local pkg="$1" ver="$2"
local id="${pkg,,}"
local nupkg="$tmpdir/$id.$ver.nupkg"
curl -fsSL "https://api.nuget.org/v3-flatcontainer/$id/$ver/$id.$ver.nupkg" -o "$nupkg" || return 1
mkdir -p "$tmpdir/$id.$ver"
unzip -q "$nupkg" -d "$tmpdir/$id.$ver" || return 1
}
download_pkg opencvsharp4 4.10.0.20241108
download_pkg opencvsharp4.official.runtime.linux-x64 4.10.0.20241108
download_pkg opencvsharp4.official.runtime.linux-x64 4.13.0.20260627
echo "=== runtime README and package references ==="
for f in \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.10.0.20241108/README.runtime.md \
"$tmpdir"/opencvsharp4.official.runtime.linux-x64.4.13.0.20260627/README.runtime.md
do
echo "--- $f ---"
sed -n '1,180p' "$f"
done
echo "=== OpenCvSharp bridge symbols in native libraries ==="
for ver in 4.10.0.20241108 4.13.0.20260627; do
f="$tmpdir/opencvsharp4.official.runtime.linux-x64.$ver/runtimes/linux-x64/native/libOpenCvSharpExtern.so"
echo "--- $ver ---"
nm -D --defined-only "$f" 2>/dev/null |
awk '{print $3}' |
grep -E '^(core|imgcodecs|imgproc|photo)_' |
grep -Ei 'inpaint|imdecode|imencode|rectangle|count.?non.?zero|dilate|getstructuringelement' |
sort -u
done
echo "=== relevant managed assembly strings ==="
python3 - "$tmpdir/opencvsharp4.4.10.0.20241108/lib/net6.0/OpenCvSharp.dll" <<'PY'
import re, sys
data = open(sys.argv[1], "rb").read()
strings = sorted(set(x.decode("ascii", "ignore") for x in re.findall(rb"[\x20-\x7e]{4,}", data)))
for s in strings:
if ("OpenCvSharpExtern" in s or
any(k in s.lower() for k in ("inpaint", "imdecode", "imencode", "rectangle", "countnonzero", "dilate", "getstructuringelement"))):
print(s)
PY
echo "=== repository platform/deployment references ==="
git ls-files | grep -E '(^|/)(README|Dockerfile|.*\.yml$|.*\.yaml$|.*\.csproj$)' |
while IFS= read -r f; do
rg -n -i -C2 'linux|windows|macos|macOS|runtime|platform|decky|steam deck' "$f" || true
doneRepository: deckyfx/web-ocr Length of output: 6857 🏁 Script executed: #!/bin/bash
set -u
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -fsSL \
'https://api.nuget.org/v3-flatcontainer/opencvsharp4/4.10.0.20241108/opencvsharp4.10.0.20241108.nupkg' |
unzip -p - 'lib/net6.0/OpenCvSharp.dll' > "$tmpdir/OpenCvSharp.dll"
echo "=== managed assembly strings for the inpainting call path ==="
python3 - "$tmpdir/OpenCvSharp.dll" <<'PY'
import re, sys
data = open(sys.argv[1], "rb").read()
items = sorted(set(x.decode("ascii", "ignore")
for x in re.findall(rb"[\x20-\x7e]{4,}", data)))
needles = ("OpenCvSharpExtern", "inpaint", "imdecode", "imencode",
"rectangle", "countnonzero", "dilate", "getstructuringelement")
for item in items:
if any(needle in item.lower() for needle in needles):
print(item)
PY
echo "=== repository files and platform statements ==="
git ls-files | sed -n '1,120p'
rg -n -i -C2 'linux|windows|macos|macOS|steam deck|decky|platform|deployment|supported' \
--glob '!server/server-csharp.csproj' . || trueRepository: deckyfx/web-ocr Length of output: 50374 Add native runtimes for supported operating systems. The server’s documented targets include Windows and macOS, but this project references only the Linux x64 runtime. Add the required Windows and macOS runtime packages so OpenCV calls do not fail on those platforms. 🤖 Prompt for AI Agents |
||
| <!-- Windows native binaries (x64); no matching macOS arm64 package exists yet) --> | ||
| <PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
Uh oh!
There was an error while loading. Please reload this page.