ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search
 All Forums  ImageEn Library for Delphi, C++ and .Net  ImageEn and IEvolution Support Forum  identify area New Topic  Reply to Topic
Author  Topic

Brazil
70 Posts

 Posted - Jun 14 2024 :  10:09:07 Good afternoonI need help. How to identify the end of the last line typed in an image, and identify exactly the starting point of the next line?In the attached image, I put an example of what I need. Identify exactly the area in red, with the aim of creating a text box and sequencing the texts starting from the last line found.I thought about scanning the document from beginning to end (vertical and horizontal), calculating the Histogram to know the starting point, but would there be a less laborious solution?thanks

38319 Posts

 Posted - Jun 14 2024 :  18:21:02 HiI'm not sure if there is a better solution other than parsing the scanlines, calculating the percentage of "White/blank" and then stop once you locate n consective rows of > z% "White/blank"Nigel Xequte Softwarewww.imageen.com

Brazil
70 Posts

 Posted - Jun 15 2024 :  07:26:58 in this case I would use GetDominantColor, correct? How to do this, in an area x of the image? in this case, only in the selected area of the image.thanks

38319 Posts

 Posted - Jun 15 2024 :  18:10:12 No, i think you would be better to write your own method using TIEBitmap.Scanline:http://www.imageen.com/help/TIEBitmap.Scanline.htmlSomething like (untested)...``` // Search the image for consecutive rows of mostly white function FindConsecutiveWhiteRows(MinWhiteValue: Integer; MinConsecutiveWhiteRows: Integer; out WhiteRowsStart: Integer; out WhiteRowsEnd: Integer): Boolean; var x, y: Integer; pPix: PRGB; Gray: Byte; rowIsWhite: Boolean; consecutiveWhiteRows: Integer; begin Result := False; WhiteRowsStart := 0; WhiteRowsEnd := 0; consecutiveWhiteRows := 0; for y := 0 to ImageEnView1.IEBitmap.Height - 1 do begin pPix := ImageEnView1.IEBitmap.ScanLine[ y ]; rowIsWhite := True; for x := 0 to ImageEnView1.IEBitmap.Width - 1 do begin if (pPix^.R < White_MinWhiteValue ) or (pPix^.G < MinWhiteValue ) or (pPix^.B < MinWhiteValue ) then begin rowIsWhite := False; Break; end; inc( pPix ); end; if rowIsWhite then inc( consecutiveWhiteRows ) else consecutiveWhiteRows := 0; if consecutiveWhiteRows >= MinConsecutiveWhiteRows then begin Result := True; WhiteRowsStart := y - consecutiveWhiteRows + 1; WhiteRowsEnd := y; exit; end; end; end;```Nigel Xequte Softwarewww.imageen.com

Brazil
70 Posts

 Posted - Jun 17 2024 :  14:07:45 Thanks for the help Nigel, but the way you put it, I couldn't understand or advance the solution lol... would we be able to work with GetDominantColor only in the area selected in the image? I think this way I can progress better, considering that all my images will be black and white

38319 Posts

 Posted - Jun 17 2024 :  18:54:02 HiThe current version does not support selections for GetDominantColor(), but you can email me for an updated method that does.Nigel Xequte Softwarewww.imageen.com
Topic
 New Topic  Reply to Topic Jump To: Select Forum ImageEn Library for Delphi, C++ and .Net       ImageEn and IEvolution Support Forum  -------------------- Home Active Topics Frequently Asked Questions Member Information Search Page