Forum Discussion

sanjay0288's avatar
sanjay0288
Frequent Contributor
13 years ago

Help needed in gettign text from an image

Hi I need help in fetching the word "functional testing" from the image attached.



Please help on the same

7 Replies

  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi ,

    It is difficult to fetch the text from the image.. as the text is shown as coloured pixels.



    I am afraid , we can not fetch the text from image.



    The thing is "Image" is an object which rendered with pixels. I am wondering , how we can read the pixels.



    Need to do R&D on this. :)
  • sanjay0288's avatar
    sanjay0288
    Frequent Contributor
    Hi I had written the below code.

    Set p = Sys.Process("mspaint").Window("MSPaintApp", "untitled.JPG - Paint", 1).Picture(0,0,-1,-1, true)

      set x= p.GetRect(135,331,137,346)

     Set OCRObj = OCR.CreateObject(x)

     Set ocrOpt = OCRObj.CreateOptions

     Set Font = ocrOpt.Fonts.Add

     Set Font = ocrOpt.Fonts.Add

     Font.Name="Arial"

     ocrOpt.ExactSearch=True

     ocrOpt.ActiveRecognitionSet=2

       ocrOpt.BinarizationThreshold =100  

     'Font.Styles.Add 2  ' Choosing bold font type

      vTempStr1 = OCRObj.GetText(ocrOpt)

         Msgbox vTempStr1

    But i am not able to fetch  the entire string functional. Any thoughts on this?

  • Hi,


     


    The OCR feature is not very reliable in this case. Besides that, you have to choose settings that match the target text - this is not very easy.


    Why don't you want to get the needed text from the page opened in a browser (or is this image just an example?)? In this case, you can use TestComplete's Web Testing.


     

  • sanjay0288's avatar
    sanjay0288
    Frequent Contributor
    Hi,

     This was just an example. Actually i was trying to fetch text from the title bar of an Afx Window(component developed in C++) and was unable to retrieve it. Tried to use the WndCaption property of the title bar and had nop success since part of the text changes dynamically when some error occurs. So thought of using the OCR technique.

    Is there any way to solve my problem?


  • Hi,


     


    What is the WndClass property value of the bar (you can check that in the Object Browser)? Your application must be complied with debug information - in this case, you can use native properties and methods to test the control. It would be better if you provided us with a sample containing the control so that we could try testing it with TestComplete.


  • Hi


     


    It looks like your attachment was blocked. Please zip your app and attach the archive here.