OCR of the screenshot and blurring by regexp, Delphi

Job ID: 34444664

Budget: $1,500 – $3,000 USD

We need to create a screen recorder on Delphi 10.4 with 1sec fps what will be blurring sensitive text on the image by regular mask. As a result you will create a program that saves bmp files (screenshots) every 1sec in the program's subfolder.

E.g it may work as a timer with 1sec with this code

function GetScreenShotBMP(Quality: TPixelFormat = pf32bit; A8bitLimit: Cardinal = 0): TBitmap;
const
CAPTUREBLT = $40000000;
var
DesktopCanvas: TCanvas;
DC: HDC;
Left, Top: Integer;
begin
Result := TBitmap.Create;
try

DC := GetDC(0);

Result.PixelFormat := Quality;

try
if (DC = 0) then
Exit;

Result.Width := Screen.DesktopWidth;
Result.Height := Screen.DesktopHeight;
Left := Screen.DesktopLeft;
Top := Screen.DesktopTop;

if A8bitLimit > 0 then //use 8bit to avoid out of memory on many monitors
begin
if (Result.Width * Result.Height) > A8bitLimit then
Result.PixelFormat := pf8bit;
end;

DesktopCanvas := TCanvas.Create;
try
DesktopCanvas.Handle := DC;

BitBlt(
Result.Canvas.Handle,0,0,Result.Width,Result.Height,
DesktopCanvas.Handle,Left,Top,SRCCOPY { CAPTUREBLT}
);
//sleep(1000);
finally
DesktopCanvas.Free;
end;
finally
if (DC <> 0) then
ReleaseDC(0, DC);
end;
except
Result.Free;
Result := nil;
end;
end;


The problem is, that the blurring code should work fast, much faster than 1sec. It means that your algorithm should detect new text on updated regions of the image only.. As our test show that full screen image text recognition in tesseract takes 3-7sec. Also, if we have no screen update, we do not need to search for new text regions at all...

The basic test is to blur credit card numbers.
Related categories: Delphi OCR