Jump to content
TroisVerites

Findcolor in a TscarBitmap

Recommended Posts

Hello,

 

I try to find functions FindColorsTol ; FindColorsSpiralTol ; FindDTM working on a TscarBitmap.

 

1) I want to avoid the capture of this bitmap too many times then I use :

 

GetClient.CaptureEx

 

2) I am looking for the functions working on the TscarBitmap that I captured.

 

3) At the end , I release the TscarBitmap

 

Can you help me ?

Link to comment
Share on other sites

Something like this???

 

program New;

var
 Bmp: TSCARBitmap;
 BmpClient: TSCARBitmapClient;
 CurClient: TSCARClient;

begin
 CurClient := GetClient();                    // Save current client so we can restore it later.
 Bmp := CurClient.Capture();                  // Grab screenshot of current client.
 BmpClient := TSCARBitmapClient.Create(Bmp);  // Create client from bitmap.
 SetClient(BmpClient);                        // Set new client as SCAR's target.

 // Do something here.

 SetClient(CurClient).Free();  // Set SCAR's target back to orignal client and
                               // free bitmap client.
 Bmp.Free();                   // Free bitmap.
 CurClient.Free();             // Free client object now that we're done with it.
end.

Edited by Bixby Sayz
Link to comment
Share on other sites

Thanks for the answer.

 

I tried to use like this but the code is not faster.

 

1) Capture around 1 ..2 ms

2) FindColorsTol around 15..32ms * X times. This time is when the function didn t find any color.

 

I think the time used by FindColorsTol , depends of the area size 'Box( 65, 100,1024, 575);

 

I need to find a way better

Link to comment
Share on other sites

I don't really understand what you are trying to do. Why are you capturing to bitmap in the first place instead of simply searching on the client? And if it is not finding the color then your colors are wrong, or it has to wait until the colors appear?

 

It is often difficult to help when given minimal details to go on.

Link to comment
Share on other sites

HI BixBy

 

I try to make some finds for a color in a area as quicker as possible.

 

1) My first thinkings were :

- Capture the Area

- Make finds here , more than one time.

 

2) I was wrong , the time is the same , as if I search in client.

 

3) May be , I need to modify the way I use those functions:

- Reduce area size

- use FindColorsSpiralTol instead normal FindColorsTol , FindColors

 

4) I like to know what happen inside the functions. I don t have the source code then I can not see it.

Link to comment
Share on other sites

- Reduce area size

 

This more than anything will speed things up. There is a limit as to how fast you can search. It does take time to perform a search. Unless you have trouble reading the client directly I would avoid capturing to a bitmap. It is just going to slow things down.

 

I am curious what you are doing that getting the absolute fastest search time is vital. Screen must be changing very fast.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...