I need to edit the Needle Image file that I captured with the Image Capture Tool. I need to magnify the images and remove any pixels above a line. I am using the image capture functions to locate a popup box so I can use Textract to scrape the text. What color depth, etc settings are necessary so Macroscheduler recognizes it as one of its captures? Can this be done with Paint or do I need to use something else?
Thank you
Editing images captured with the Image Capture Tool
Moderators: JRL, Dorian (MJT support)
Image Recognition and OCR
Check the blogs for Image Recognition and OCR if you have not already done so.
If you use Image Recognition to find the area of the screen you want to perform OCR on, you get best results if the display options used on playback match thse when you created your image file. It is best to turn off any display options that cause the bitmap images to change - turn off all effects, especially font smoothing. Avoid settings that cause gradients on window titles and backgrounds. Also standardaze on things like fonts, font size, icon size, regional settings. You will get the most consistant esults using the 24 or 32 bit color. If you record at 24 or 32bit color and must play back at 16 bit color, set your color depth to 8 or higher. If you detect dithering (speckled images) at 16bit, you will need to capture images of dithered and undithered versions of icons used to find the text area.
You can also use GetActiveWindow to find the area of the screen of the popup you want to do OCR on and not have to worry so much about all the image recognition restrictions.
As for the OCR itself, that depends on the 3rd party tool's handling of display settings. Textract claims to handle font smoothing, but I would avoid it. I have found Textract has problems with underlines on letters with tails. I use MODI which handles the underlines, but has other problems.
I'm not sure why you need to edit the Needle Image file, is that the one you are using with Image Recognition to find the screen area containing text? Usually I just recapture it, but sometimes use Paint or Microsoft Picture Manager to carefully crop it. Had no problems with these tools.
If you capture needle images dynamically in your script , you can crop them with the ScreenCapture command. ScreenCapture is best because you know the image will be compatible with MacroScheduler. If you use other tools, save at the original color depth and test your images.
Some users use ImageMagik if they need to do more extensive editting on the Haystack image. For example, MODI requires a 2 or 3 pixel boundry all around the text area or it cannot find the text. ImageMagik can draw the boundry to cover graphics that can be confused with text. As I recall, Textract did not require the this boundry, you could just tightly crop the text.
In short, you can do what you suggest. When in doubt - test.
Gale
If you use Image Recognition to find the area of the screen you want to perform OCR on, you get best results if the display options used on playback match thse when you created your image file. It is best to turn off any display options that cause the bitmap images to change - turn off all effects, especially font smoothing. Avoid settings that cause gradients on window titles and backgrounds. Also standardaze on things like fonts, font size, icon size, regional settings. You will get the most consistant esults using the 24 or 32 bit color. If you record at 24 or 32bit color and must play back at 16 bit color, set your color depth to 8 or higher. If you detect dithering (speckled images) at 16bit, you will need to capture images of dithered and undithered versions of icons used to find the text area.
You can also use GetActiveWindow to find the area of the screen of the popup you want to do OCR on and not have to worry so much about all the image recognition restrictions.
As for the OCR itself, that depends on the 3rd party tool's handling of display settings. Textract claims to handle font smoothing, but I would avoid it. I have found Textract has problems with underlines on letters with tails. I use MODI which handles the underlines, but has other problems.
I'm not sure why you need to edit the Needle Image file, is that the one you are using with Image Recognition to find the screen area containing text? Usually I just recapture it, but sometimes use Paint or Microsoft Picture Manager to carefully crop it. Had no problems with these tools.
If you capture needle images dynamically in your script , you can crop them with the ScreenCapture command. ScreenCapture is best because you know the image will be compatible with MacroScheduler. If you use other tools, save at the original color depth and test your images.
Some users use ImageMagik if they need to do more extensive editting on the Haystack image. For example, MODI requires a 2 or 3 pixel boundry all around the text area or it cannot find the text. ImageMagik can draw the boundry to cover graphics that can be confused with text. As I recall, Textract did not require the this boundry, you could just tightly crop the text.
In short, you can do what you suggest. When in doubt - test.
Gale
Image Recognition and OCR
Thank you for the response and the additional information. I believe it will be quite helpful.
The reason that I need to edit the needle image is becaused I am capturing a yellow rectangle with text in it which is not a Windows window. The background along the margin can vary; therefore, if any background pixels are included in the needle image, MS does not match it. Also its size and location vary depending on what information it contains.
Thanks,
ken
The reason that I need to edit the needle image is becaused I am capturing a yellow rectangle with text in it which is not a Windows window. The background along the margin can vary; therefore, if any background pixels are included in the needle image, MS does not match it. Also its size and location vary depending on what information it contains.
Thanks,
ken
Varying backgrounds
Can you post a couple of screenshots of the upperleft and lowerright corners showing the manner in which the backgrounds vary?
Does the background vary for both the inside and outside margin?
If there is a lot of contrast between the margin and the background increasing the color tolerance will sometimes let you recognize the corners while ignoring the background. Experiment until you find a color tolerance that works.
If the color tolerance approach does not work, try creating Needle Images for a short sections of vertical and horizontal edges. FindImagePos will return a large NumFound for both Needle Images. Half of the Xarr coordinates for the Vertical Edge Needle should give the location of the left edge, the other half for the Right Edge. Likewise, half of the Yarr coordinates for the Horizontal Edge Needle should give the location of the Top Edge and the other half for the Bottom Edge.
Let us know if either of these methods work.
Gale
Does the background vary for both the inside and outside margin?
If there is a lot of contrast between the margin and the background increasing the color tolerance will sometimes let you recognize the corners while ignoring the background. Experiment until you find a color tolerance that works.
If the color tolerance approach does not work, try creating Needle Images for a short sections of vertical and horizontal edges. FindImagePos will return a large NumFound for both Needle Images. Half of the Xarr coordinates for the Vertical Edge Needle should give the location of the left edge, the other half for the Right Edge. Likewise, half of the Yarr coordinates for the Horizontal Edge Needle should give the location of the Top Edge and the other half for the Bottom Edge.
Let us know if either of these methods work.
Gale