|
Post by jblade on Apr 8, 2018 23:00:33 GMT
Are there any functions which can read an image(In a region)? I want to get the image detail. Thx
|
|
|
Post by Mercobots on Apr 9, 2018 0:27:08 GMT
what details you need to know
|
|
|
Post by jblade on Apr 9, 2018 0:47:25 GMT
I try to upload an image from googl drive to my thread, but it failed. Basically, my target image is a gem image with gem's detail. For example, defense, attack, recovery... something like that.
|
|
|
Post by Mercobots on Apr 9, 2018 1:00:35 GMT
|
|
|
Post by jblade on Apr 9, 2018 1:19:17 GMT
hmm, actually, the gem looks like (main) defense +11% (or defense + 220) (sub) defense +54 (sub) attack +6% (sub) recovery + 6% what I want is try to get main property is percentage or flat(e.g.+220) and also want to count how many sub-property this gem hold(in this example is 3).
|
|
|
Post by Mercobots on Apr 9, 2018 1:30:50 GMT
is possible but hard cuz the gems are not all the same , do the following create a shared folder at google drive with some gems pic and share it with me mercobots@gmail.com
|
|
|
Post by jblade on Apr 9, 2018 1:53:23 GMT
Already share with you
|
|
|
Post by Mercobots on Apr 9, 2018 2:08:25 GMT
for what i see is possible to do it but is extremely hard too You will need - A pic from each word attack,defence... - A function to calculate each OCR region depending the pic word - A function to validate the OCR numbers - A function to diff the % from float (can be done with images too) - A function to diff from decimal numbers too (can be done with images too)
|
|
|
Post by jblade on Apr 9, 2018 2:16:48 GMT
ok, I will try. All functions use numberOCR()?
|
|
|
Post by Mercobots on Apr 9, 2018 2:27:08 GMT
ok, I will try. All functions use numberOCR()? no no this is only a quick tips summary the most important to do now is to crop all word pic and auto calculate the regions for numbers once you have done this part come back to ask for next steps !! don't forget to use highlights
|
|
|
Post by jblade on Apr 9, 2018 2:45:55 GMT
I use 'snapAndPlay.v1.9.0.lua' to get the regions. Is that right?
|
|
|
Post by Mercobots on Apr 9, 2018 8:50:41 GMT
I use 'snapAndPlay.v1.9.0.lua' to get the regions. Is that right? for what you need try ankulua.boards.net/thread/531/tool-snapyourscript, but be aware you need to code all procedures, for example to get ocr region after the image match -- Function to calculate OCR region -- ---------------------------------- function getOCRRegion(match) if match then -- save image location and size local img = { x = match:getX(), y = match:getY(), w = match:getW(), h = match:getH(), }
-- SET OCR REGION local ocr_r = Region(img.x + img.w, img.y, 100, img.h)
-- DEBUG toast('img') match:highlight(2) -- toast('ocr region') ocr_r:highlight(2) -- END DEBUG
local val, ocr_result = numberOCRNoFindException(ocr_r, "num_")
if ocr_result and val < 9999 then return val end end
return false end
-- start -- ---------------------------------- if exists('defence.png') then local val = getOCRRegion(getLastMatch()) print('defence',val) end
if exists('attack.png') then local val = getOCRRegion(getLastMatch()) print('attack',val) end
|
|
|
Post by jblade on Apr 10, 2018 1:49:59 GMT
-- SET OCR REGION local ocr_r = Region(img.x + img.w, img.y, 100, img.h) After img.y, why there is a 100? what is this 100 stand for? After the first region, make second region 100 pixels wider?
|
|
|
Post by AnkuLua on Apr 10, 2018 2:24:19 GMT
|
|
|
Post by jblade on Apr 10, 2018 2:32:04 GMT
yeah, so noob question... Didn't focus on img.x+img.w
|
|