[Sikuli-driver] [Question #697757]: IDE crashes when I run OCR

2021-06-28 Thread Waikit Lau
New question #697757 on SikuliX:
https://answers.launchpad.net/sikuli/+question/697757

I'm trying to do number extraction from a webpage using Tessaract/OCR. 

I have installed Tesseract v4.1.1.  on my MacOS machine (running 10.13.6 High 
Sierra). 

When I run just this test code snippet, the Sikuli IDE crashes. The crash 
repost says "Termination Reason: DYLD, [0x4] Symbol missing"

import sys  
priceRegion = Region(79,192,80,32)
price = priceRegion.text()
print(price)

What am I doing wrong?

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697757]: IDE crashes when I run OCR

2021-06-28 Thread RaiMan
Question #697757 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697757

Status: Open => Answered

RaiMan proposed the following answer:
running macOS 11.4 using Java 11 and IDE 2.0.5 from a Terminal via java
command.

I have Tesseract 4.1.1 installed via homebrew.

tesseract --version says:
tesseract 4.1.1
 leptonica-1.79.0
  libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.1.0 : zlib 1.2.11 : 
libwebp 1.1.0 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found FMA
 Found SSE

and a test as
print selectRegion().text()

simply does what it should do.

So check your setup and run from terminal with parameters -v -c

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697732]: macOS M1: how to use a custom build of OpenCV

2021-06-28 Thread Jeff Harmon
Question #697732 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697732

Jeff Harmon posted a new comment:
Appreciate your time RaiMan!

Everything worked under Rosetta 2, but I am struggling to get an
observer to scan a Region faster enough.  Here is some sample code I
have used to measure:

Settings.ObserveScanRate = 100F;

Region histogramRegion = new Region(2236,113,323,200) //323x200 region
to observe

String histogramRegionAppearCode = 
histogramRegion.onAppear(blankHistogramDevelopPattern.exact(), 
new ObserverCallBack() {
@Override
public void appeared(ObserveEvent event) {
if (logger.isDebugEnabled()) logger.debug("test: found 
blank histogram");
event.repeat();
}
}
);

logger.debug("Starting histogram observer...");
histogramRegion.observeInBackground();
wait(1);  //milliseconds
logger.debug("Stopping histogram observer");
histogramRegion.stopObserver();

if (histogramRegion.hasEvents()) {
logger.info("Found " + 
histogramRegion.getObserver().getCount(histogramRegionAppearCode));
}


I get a total of 10 events in 10 seconds when the Region has an exact match the 
entire time the observer is running.  The automation I am trying to create has 
the histogram region match the blank pattern for only 0.13 seconds.  I was 
hoping that going native on Java/OpenCV would allow for faster scans.

I have now hacked a port together of all the components.  I have
everything working with native OpenCV, a native port of MacUtil (used
XCode to help me migrate things and had to do some minor refactors), and
Zulu native JDK 11.  Unfortunately, the code above still only gives me a
match about once per second.  Maybe my code to test the time it takes
for an observer to have an appeared event is flawed?

My end goal is to have an observer tell me that the application has had
the histogram region be blank and then not blank within 0.3 seconds.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697732]: macOS M1: how to use a custom build of OpenCV

2021-06-28 Thread Jeff Harmon
Question #697732 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697732

Jeff Harmon posted a new comment:
BTW, in order for JNI calls to work under the Zulu native JDK I had to
update JNA to version 5.8.0


net.java.dev.jna
jna
5.8.0


Just thought that may help you as you look into updating Sikuli to have
official native support on M1.  It took me forever to find that gem.
Until I did that I got JNA UnsatisfiedLinkError messages.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697732]: macOS M1: how to use a custom build of OpenCV

2021-06-28 Thread RaiMan
Question #697732 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697732

RaiMan proposed the following answer:
First of all: thanks for your efforts and the information about the
results.

I will surely come back with the one or other question the next days and
hope, that it is ok, when I contact you directly on your launchpad id.

About the observe case: I will try to setup a similar case and look into
it.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697732]: macOS M1: how to use a custom build of OpenCV

2021-06-28 Thread RaiMan
Question #697732 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697732

RaiMan proposed the following answer:
Ok, got it.

There is another option value:
Settings.RepeatWaitTime = 0 (set globally for all regions)
or
someRegion.setRepeatWaitTime(0)

... the default is 1

So an
event.repeat()
leads exactly to 1 observe per second.

my test:
Settings.RepeatWaitTime = 0
Settings.ObserveScanRate = 50;

reg = Region(238,166,361,308)
img = "img.png" # 167x230
pimg = Pattern(img).exact()

reg.find(pimg).highlight(2)

def handler(evt):
global count
count += 1
evt.repeat(0)

count = 0
running = 5.0
reg.onAppear(pimg, handler)
reg.observeInBackground()
wait(running)
print count/running

gives 33 observes per second.

All the best.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #697732]: macOS M1: how to use a custom build of OpenCV

2021-06-28 Thread RaiMan
Question #697732 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697732

RaiMan proposed the following answer:
... and yes: this should be in the docs ;-)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp