feat(engine): add watermark detection and conditional removal#13
feat(engine): add watermark detection and conditional removal#13dannycreations wants to merge 1 commit intoallenk:mainfrom
Conversation
fc6cdb7 to
79f8522
Compare
79f8522 to
bdf0fed
Compare
|
Hi @dannycreations , thanks for this PR! The idea of detecting watermark presence before removal is valuable - it could prevent unnecessary processing and avoid potential artifacts on non-watermarked images. However, I have some concerns about making this the default behavior before the detection reliability is fully validated. 🔧 Suggested Changes1. Make Detection Opt-in (Not Default)Please add a Rationale:
# CLI usage
GeminiWatermarkTool -i input.jpg -o output.jpg --remove --detect-mode2. Detection Algorithm ConcernsThe current cv::matchTemplate(gray_f, alpha_region, result, cv::TM_CCOEFF_NORMED);Issues:
3. Suggested Improved AlgorithmA more reliable detection approach would compare the watermark region against its surrounding context: bool WatermarkEngine::detect_watermark(
// Bounds check
// === Method 1: Brightness Analysis ===
// Watermark region should be brighter due to white logo blending
// Reference region: area just above the watermark
// Convert to grayscale
// Calculate statistics
// === Method 2: Alpha-weighted Brightness Check ===
// Where alpha is high, the pixel should be closer to white (255)
// === Decision Logic ===
// Watermark characteristics:
// 1. Region is brighter than surroundings (white logo blended in)
// 2. Contrast is reduced (alpha blending "washes out" details)
// 3. High-alpha areas should be relatively bright
// Require at least 2 of 3 indicators4. Additional Suggestions
double detect_watermark_confidence(const cv::Mat& image, ...);This allows users to set their own threshold.
GeminiWatermarkTool -i input.jpg -o output.jpg --remove --detect-mode --forceSummary
I really appreciate the initiative! Once these changes are made, this would be a valuable addition to the tool. |
bdf0fed to
9b3412a
Compare
|
@allenk already implement multi stage detection and tested with over 100+ images it success remove watermark and ignore if no watermark, im still let it enable by default because the default behaviour is |
- Implement multi-stage detection using spatial, gradient, and statistical analysis. - Add `--unsafe` CLI flag to bypass detection and force watermark removal. - Update removal logic to skip processing if detection confidence is below 0.30.
9b3412a to
3f277b5
Compare
… streamline CLI sections - Rebrand GUI section as "Major Update" with prominent announcement - Restructure CLI into two complementary sections: - "What's New" for multi-file support, --force, and --threshold - "Quick Start" with app icon for drag-and-drop simplicity - Enhance watermark detection section with credit to @dannycreations (PR #13) - Add technical details: circuit breaker, star-shaped pattern matching, false positive mitigation for white/flat regions - Remove duplicate Quick Start, Usage, and Batch Processing subsections
… streamline CLI sections - Rebrand GUI section as "Major Update" with prominent announcement - Restructure CLI into two complementary sections: - "What's New" for multi-file support, --force, and --threshold - "Quick Start" with app icon for drag-and-drop simplicity - Enhance watermark detection section with credit to @dannycreations (PR #13) - Add technical details: circuit breaker, star-shaped pattern matching, false positive mitigation for white/flat regions - Remove duplicate Quick Start, Usage, and Batch Processing subsections
|
Hi @dannycreations, thank you for this PR — and sorry for the delayed response!
This addresses some of the reliability concerns with single-pass matchTemplate — particularly false positives on white backgrounds and false negatives on textured regions.
Because these changes touched the core engine API (process_image now returns ProcessResult, detect_watermark returns DetectionResult), and the codebase has been restructured (src/core/, src/cli/, src/gui/), this PR unfortunately can no longer be merged cleanly. |
|
@allenk sure, will close the pull thanks👍 |

Just simple QOL so if images has no watermark it does not attempt to remove causing #6 (comment)