Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 07:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Searchng libs

Discussion on Searchng libs within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 1908
Join Date: Jan 2013
Posts: 832
Received Thanks: 629
Searchng libs

Hello guys I am working on new searching libraries for C# bots.
Right now I have pixel-imagesearch which can find an image in cca 5-7ms on the other hand there are more advanced emgu OpenCV libs(for C#) which make better matches(with min. side effects)...but my fastest search there was 390ms.

Can be this speed somehow improved ? Or it is unavoidable price for such good matching results ? Do you have some recommendations ?
ssamko is offline  
Old 07/08/2017, 13:35   #2



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
If you want to impove the speed, use a good c++ lib or write the implementation by your own and reduce the code/complexity/runtime to fit your minimum needs.
Shawak is offline  
Thanks
1 User
Old 07/08/2017, 20:36   #3
 
atom0s's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 175
Received Thanks: 125
Use threading. If you are pixel searching, break up the screen into sections and have each thread handle a single section itself. If one of the threads finds what is needed trigger an event to kill the other threads and collect the result as needed.
atom0s is offline  
Thanks
1 User
Old 07/08/2017, 22:33   #4
 
elite*gold: 1908
Join Date: Jan 2013
Posts: 832
Received Thanks: 629
Quote:
Originally Posted by Shawak View Post
If you want to impove the speed, use a good c++ lib or write the implementation by your own and reduce the code/complexity/runtime to fit your minimum needs.
OpenCV is written in C++ and I use Emgu wrapper for that...I found out that function I have written run on CPU...now I am trying to rewrite it to using GPU in order to boost speed

Quote:
Originally Posted by atom0s View Post
Use threading. If you are pixel searching, break up the screen into sections and have each thread handle a single section itself. If one of the threads finds what is needed trigger an event to kill the other threads and collect the result as needed.
but when you split source img to lets say 5 smaller images and run it on more threads there comes 1 problem...what those object which are split also ? so on 1 split part will be a half of searched object...and on the 2nd will be the second part...what in this case ?
ssamko is offline  
Old 07/08/2017, 22:38   #5
 
.Scy's Avatar
 
elite*gold: 15
Join Date: Jul 2010
Posts: 3,926
Received Thanks: 1,158
Quote:
Originally Posted by ssamko View Post
but when you split source img to lets say 5 smaller images and run it on more threads there comes 1 problem...what those object which are split also ? so on 1 split part will be a half of searched object...and on the 2nd will be the second part...what in this case ?
I'd say it depends on the images you are given. If your goal is to find certain things, that are rather small on the overall image and you know that the objects you are looking for are more common in certain areas, you could simply split up the image in fitting pieces and try running the search, if there is no result, either take an overlap of your pieces or simply search the whole picture.


that'll help if you have enough data on the images you'll search, otherwise you shouldn't split the image.
.Scy is offline  
Old 07/11/2017, 19:17   #6
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462


Edit:
Don't even try bit manipulation to speed up the comparing if's. This simply doesnt work well with c#.
This is in case the fastest way i could imagine with c# (without killing oop completely)

Edit 2:
This "screenshot" function works perfect but it's pretty slow. You could copy the bits of the bitmap quite earlier but i didn't find how
YatoDev is offline  
Old 07/11/2017, 21:44   #7
 
elite*gold: 1908
Join Date: Jan 2013
Posts: 832
Received Thanks: 629
Quote:
Originally Posted by .Scy View Post
I'd say it depends on the images you are given. If your goal is to find certain things, that are rather small on the overall image and you know that the objects you are looking for are more common in certain areas, you could simply split up the image in fitting pieces and try running the search, if there is no result, either take an overlap of your pieces or simply search the whole picture.


that'll help if you have enough data on the images you'll search, otherwise you shouldn't split the image.
Objects I am searching can be on random place on desktop(+ there can be more than 1) so I would say that splitting is not the best idea


Quote:
Originally Posted by YatoDev View Post


Edit:
Don't even try bit manipulation to speed up the comparing if's. This simply doesnt work well with c#.
This is in case the fastest way i could imagine with c# (without killing oop completely)

Edit 2:
This "screenshot" function works perfect but it's pretty slow. You could copy the bits of the bitmap quite earlier but i didn't find how
I have already had searching func with unsafe code which can find result in cca 5-7ms but what you have sent me has more modes...thnx....yes...this is the fastest way...but searched objects which have lets say another rotation or have same shape but another color is harder to detect this way(+with bigger tollerancy there come some false-positive results)...thats why I try to use more advanced libs
ssamko is offline  
Old 07/12/2017, 09:33   #8
 
atom0s's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 175
Received Thanks: 125
Quote:
Originally Posted by ssamko View Post
but when you split source img to lets say 5 smaller images and run it on more threads there comes 1 problem...what those object which are split also ? so on 1 split part will be a half of searched object...and on the 2nd will be the second part...what in this case ?
You can use percentage based matching then allowing for parts of the image to be validated in one thread and then ensuring the rest is matched in another thread. There are different ways to go about it, just like pattern scanning in any other method such as strings, bytes of data, etc.


OpenCV is your best bet probably in this case. It has GPU capabilities already built into it:
atom0s is offline  
Old 07/12/2017, 10:14   #9
 
elite*gold: 1908
Join Date: Jan 2013
Posts: 832
Received Thanks: 629
Quote:
Originally Posted by atom0s View Post
You can use percentage based matching then allowing for parts of the image to be validated in one thread and then ensuring the rest is matched in another thread. There are different ways to go about it, just like pattern scanning in any other method such as strings, bytes of data, etc.


OpenCV is your best bet probably in this case. It has GPU capabilities already built into it:
OpenCV itself can be used only in java,python or c++ i think...I am using Emgu C# wrapper for that. Right now I have finally done CPU and also GPU searching algorithm(quite fast) but the result gives me only 1 location(when on the source pic is more than 1 objects same like template)...function MinMax....I have read something about FloodFill with which can be this best match somehow rewritten/deleted and running MinMax again will give 2nd best location. Do somebody have experiences with OpenCV 3.2 or EmguCV wrapper in order to help me to make this work?

My stack-overflow topic with source-code preview:
ssamko is offline  
Old 07/12/2017, 22:35   #10
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
Quote:
Originally Posted by ssamko View Post
I have already had searching func with unsafe code which can find result in cca 5-7ms but what you have sent me has more modes...thnx....yes...this is the fastest way...but searched objects which have lets say another rotation or have same shape but another color is harder to detect this way(+with bigger tollerancy there come some false-positive results)...thats why I try to use more advanced libs
i don't see why iterating an array of pixels/images isn't an option.
Or you could compile image mutations at runtime.

never had issues with that. Invoking the gpu typically does not give any performance gain for such a small task.
YatoDev is offline  
Old 07/12/2017, 23:00   #11
 
elite*gold: 1908
Join Date: Jan 2013
Posts: 832
Received Thanks: 629
Quote:
Originally Posted by YatoDev View Post
i don't see why iterating an array of pixels/images isn't an option.
Or you could compile image mutations at runtime.

never had issues with that. Invoking the gpu typically does not give any performance gain for such a small task.
I have played with normal ImageSearch for a long time and I can see some problems there. I can give you an example:
In game Dark Orbit is ore named Palladium which is blue(each ore can have 1 of 25 blue color comblinations) + it is rotating + behind it is blue background...so with small tollerancy it detects lets say every 4th palla...but with bigger it detects all+it detects ship and background also(false-positive results)...thats why I wanna use some advanced lib which can see shape and it is not just searchin through pixel array.

To that GPU performance. My new advanced algorithm was 2x faster made on GPU than on CPU
ssamko is offline  
Reply


Similar Threads Similar Threads
Searchng for pvp only popular server
10/25/2015 - Lineage 2 - 0 Replies
Hello I am wondering if there is a server that fullfills those criteria: Full pvp. Extremely high rate. One day almost to get full level. Free class change , sub etc. Gear can be obtained easily, no need to farm at all. Many active people, so siege can be done every day. English language (mostly) HI5 preferred but could be any chronicle. Yeah it seems like a dream but I don't know what's out there plz suggest me :)
[RELEASE LiBs für R00T] 32BiT Lib's die auch nur nötig sind und funktionieren
06/09/2012 - Metin2 PServer Guides & Strategies - 38 Replies
Nabend! :cool: Da ich Moderator in M2 Section bei EDG-Servers wurde wollte ich auch etwas veröfftlichen für die die einen R00T Server haben und ein M2Server eröffnen wollen. Wie einige es bemerkt haben das wenn ihr die 1Klick Files von rain benutz, läuft das System stabil. Aber wenn ihr auf ein R00T umsteigt und die kompletten "lib" Datei überschreibt könnte euer System nach einigen Tagen abstürzen oder auch früher :( Deswegen ist es nicht empfohlen Systemdatei zu überschreiben! ...
SEARCHNG SILKROAD ACCOUNT!
04/23/2011 - Silkroad Online Trading - 0 Replies
Hey guys im searching a silkroad account 90+ i preffer 2hand warrior / full str glavier trading my Battlefield Badcompany 2 + Addon Vietnam + Medal of honor EADM account or my Call of Duty Black ops add me in skype: disglo01 TRADE ONLY WITH MIDDLEMAN
[FRAGE] 64-Bit Libs
04/11/2010 - Metin2 Private Server - 16 Replies
Hallo Liebe Com. Ich habe mal ne frage und zwar: Wie viel MB sind die 64-Bit Libs groß? Nur die Libs ohne Sf o.ä. Nur wenige KB?
Ich suche Libs für FreeBSD 8.0
03/05/2010 - Metin2 Private Server - 9 Replies
hi Leute, kurz und knapp. Ich suche die FREEBSD 8.0 lib files! Ich abe zurzeit nur die Lib files für FREEBSD 7.2 ! Wen jemand die libs hat bitte mir eine pn schreiben mit DL link oder hier in den Thread posten. mfg



All times are GMT +1. The time now is 07:08.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.