Results 1 to 5 of 5

Thread: Gustavo Daud's library

  1. #1

    Gustavo Daud's library

    I use old Delphi to occasionally program small utilities, so you can't say I'm good at Delphi. I have used the Gustavo Daud's library in the past
    (PNG Delphi v.1.564)
    https://torry.net/authorsmore.php?id=6929

    Using it on Windows XP, Delphi 7... And now I have found update pngdelphi2 (not tested).


    1. WHAT I KNOW ALREADY TO DO:
    In the past I already learned how to load png file and print it to image object.
    It was like:

    Code:
    var soubmp, defsoubmp, path, filename, ext, s:string;
    stream: TMemoryStream;
    Image: TPngObject;
    /// ... skipped
    Stream := TMemoryStream.Create;
    Stream.LoadFromFile( s );
                          Image := TPngObject.Create;
    try ...
    try
      Image.LoadFromStream(Stream);
      Image_center.Picture.Bitmap.Width := Image.Width;
      Image_center.Picture.Bitmap.Height := Image.Height;
      Image.Draw(Image_center.Picture.Bitmap.Canvas, Rect(0, 0, Image.Width, Image.Height));
    
      Image_center.width := Image.width;
      Image_center.height := Image.height;
      Image_center.Left := ( form1.clientWidth div 2 ) - (Image_center.width div 2);
      CropBitmap(Image_center.Picture.Bitmap, 1, 25, Image.width,Image.height-25);
    finally
      Image.Free;
    end;
    finally
       Stream.Free;
    end;
    The code just update image from file... This is all my knowledge about images and png. But now I need to do some advanced work.

    I have pngimage with text (black background, text white or colored, can contain images like dialogue cloud with text.). And I want to create program small/easy OCR detection just to find out some things about the image.

    2. BACKGROUND: (This is just preparation for complex task because I plan to work with multiple images at time, comparing the images. The images been genarated while scrolling html document and captured to GIF, then converted to PNGs. So the complex thing/goal is to detect the shift of the text and to create another image or frame there between the frames/images because the captured animation image sloped and was not smooth... )

    3. THE GOAL:
    I would like to use the png library to read line(s) of the image and find out some information like: the gaps height between lines, line height, color of the text in a line (or in the area), areas of text and areas of round box or dialogue cloud ... and positions of these areas. This is important on the end of the image. Of sure I need to save the information. And then I can compare the image with next image to find out if the image is the same or if it was shifted upwards. Then I would like to copy the image, shift it a bit lower, and then I need to copy image from the next image and find out area to copy and to join this into new image... Hard thing to do.

    I would like to welcome your ideas and code examples, because this job is so hard for me. Thank you.

  2. #2
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,342
    Anything with recognition of text and comparing of images is hard.

  3. #3
    Quote Originally Posted by marcov View Post
    Anything with recognition of text and comparing of images is hard.
    I realized that I need to create some viewer to see multiple frames (images).
    There are two folders (A) and (B). And I need to see current image, two previous images and two next images in every group, and newly generated image later too. I think I will manage to make the viewer but not sure if the rest.... It's more complicated because the A folder contains a bit blured images generated by OCam (from a avi file of 15 fps). The B folder contains better quality from gif file, but less frames.

    So I would like to open more files from A and from B and compare and to find the best fitting image. And then to repair the frames from the group A.

    Another problem is - it seems like some frames during the scrolling are in oposite direction. It happens when scrolling and the image on the screen is not fluent.

  4. #4
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,342
    Quote Originally Posted by chlopik View Post
    Another problem is - it seems like some frames during the scrolling are in oposite direction. It happens when scrolling and the image on the screen is not fluent.
    That sounds like the scrolling doesn't take into account topdown vs bottom up images.

  5. #5
    Quote Originally Posted by marcov View Post
    That sounds like the scrolling doesn't take into account topdown vs bottom up images.
    I don't know. It is pre-programmed scrolling applied to Firefox, made by autohotkey function MouseClickDrag. So the scrolling is not fluent as needed. That is why I want to create program to repair the frames.

    I'm reading this here and this.

    Good article. But I have question. What is the fastest way for me?

    Because I do only the vertical scrolling detection, I need to detect the non black pixels only in a certain column. Or in certain columns - like a guess. For example I can try to start in the middle of the screen reading column 90. Steping by +6px. And detecting the color of pixel. If I use column detection like this, I don't need to use scanline. So how to get the data from the image if I look for one column or maybe two, three columns for color detection?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •