ScanTailor-Advanced / scantailor-advanced

ScanTailor Advanced is the version that merges the features of the ScanTailor Featured and ScanTailor Enhanced versions, brings new ones and fixes.
GNU General Public License v3.0
189 stars 7 forks source link

[Feature request] ColorTextMask. #63

Closed zvezdochiot closed 1 year ago

zvezdochiot commented 1 year ago

Hi @mara004 , @lightsilverberryfox , @vigri .

In color segmentation, I would like to process not the entire Black mask, but its cut-off part:

QImage distance_color(toGrayscale(src_by_black));
for (pixel in src_by_black)
{
    mean_color = (pixel.R + pixel.G + pixel.B) / 3;
    distance_color_pixel = 255 - abs(pixel.R - mean_color) - abs(pixel.G - mean_color) - abs(pixel.B - mean_color);
}
(bwImage*) color_text_mask = BinaryImage(distance_color, (BinaryThreshold::otsuThreshold(distance_color) + delta));

That is, I would like to isolate from the mask those areas that differ from gray.

PS: You can also use the S from HSV as the gray distance: distance_color_pixel = 255 * HSV(pixel).S;

PS2: You can also use custom clipping:

(bwImage*) color_text_mask = BinaryImage(distance_color, manual_value);

But this requires an additional regulator and saving its value in the STA project (XML).

zvezdochiot commented 1 year ago

useless.