Jump to content



Photo

Advanced Pixel Search Library


282 replies to this topic

Poll: What do you think of this library ? (48 member(s) have cast votes)

What do you think about FastFind ?

  1. It's really great, I can't imagine doing a script without it (24 votes [50.00%] - View)

    Percentage of vote: 50.00%

  2. It's of some use for me in my current scripts (10 votes [20.83%] - View)

    Percentage of vote: 20.83%

  3. I could use it some day (4 votes [8.33%] - View)

    Percentage of vote: 8.33%

  4. Looks nice, but of no use for me (5 votes [10.42%] - View)

    Percentage of vote: 10.42%

  5. I've tried it, but it doesnt fit my needs (1 votes [2.08%] - View)

    Percentage of vote: 2.08%

  6. Sounds good on the paper, but can't make it work (bug or too difficult to use it) (4 votes [8.33%] - View)

    Percentage of vote: 8.33%

Have you tried it ?

  1. Yes, I'm using it right now (22 votes [45.83%] - View)

    Percentage of vote: 45.83%

  2. Somewhat, I've done some testing, will surely use it later (12 votes [25.00%] - View)

    Percentage of vote: 25.00%

  3. I've downloaded it and just played a little with packaged demo scripts (8 votes [16.67%] - View)

    Percentage of vote: 16.67%

  4. I've downloaded it, but not tried it so far (2 votes [4.17%] - View)

    Percentage of vote: 4.17%

  5. Not downloaded it so far, but I probably will some day (1 votes [2.08%] - View)

    Percentage of vote: 2.08%

  6. It's of no interested for me. (3 votes [6.25%] - View)

    Percentage of vote: 6.25%

What is missing or should be improved ?

  1. It has all the features I may need about Pixels Handling (13 votes [16.25%] - View)

    Percentage of vote: 16.25%

  2. OK it's pretty fast, but couldn't it be faster ? (12 votes [15.00%] - View)

    Percentage of vote: 15.00%

  3. Too hard to use it, could you simplify usage ? (10 votes [12.50%] - View)

    Percentage of vote: 12.50%

  4. Some additional features would be nice to have (please explain in a message) (16 votes [20.00%] - View)

    Percentage of vote: 20.00%

  5. It really lacks some decent documentation (I still hope to find someone to help on that) (12 votes [15.00%] - View)

    Percentage of vote: 15.00%

  6. Some critical features are missing, can't use it (please explain in a message) (2 votes [2.50%] - View)

    Percentage of vote: 2.50%

  7. I found some minor bugs (please explain in a message) (3 votes [3.75%] - View)

    Percentage of vote: 3.75%

  8. I've found some serious bugs (please explain in a message) (1 votes [1.25%] - View)

    Percentage of vote: 1.25%

  9. I've never tried it so far, can't tell (6 votes [7.50%] - View)

    Percentage of vote: 7.50%

  10. It would be nice if you could provide easy access to the associated tool - FFShowPixel (3 votes [3.75%] - View)

    Percentage of vote: 3.75%

  11. I would like to use it other languages. Could you provide wrappers ? (please explain in a message) (2 votes [2.50%] - View)

    Percentage of vote: 2.50%

Vote Guests cannot vote

#121 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,072 posts

Posted 04 November 2011 - 10:45 AM

With Windows 2000 it worked well, as long as gdiplus.dll was added (another dependency of your DLL). Windows XP seemed to work fine, though the FastFind_Demo program crashed with an exception in fastfind.dll. I'm not sure why that failed, it should have worked fine on XP. Could just chalk it up to a Virtual Machine fluke though. It'd be best to test it on a true Windows XP install to make sure.





#122 1loxe2006

1loxe2006

    Seeker

  • New Members
  • 1 posts

Posted 04 November 2011 - 12:10 PM

hello everybody !
please help me,about 10 days ago I still useable but now i not use my script, when I run my script I get a message box saying "Can't start, try again".
followed by the "Failed to load FastFind.dll, application probably won't properly work." message box from FastFind.au3

#123 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 04 November 2011 - 01:24 PM

@Ascend4nt : Thank you for your report. As I use GDI+, the gdiplus.dll dependency is obvious.

@1loxe2006 : the last version should fix that problem.

Also note that CeramicWeasel has started to write a documentation on FastFind. It will be a nice addition to help people in using FastFind.

Edited by FastFrench, 04 November 2011 - 01:31 PM.


#124 fisofo

fisofo

    If you can read this, then I suck at being a ninja

  • Active Members
  • PipPipPipPipPipPip
  • 374 posts

Posted 17 November 2011 - 06:51 PM

I've been searching a while for this, thought I'd just ask here: has anyone created something like this in AutoIt? Before I dig into trying to create it, I thought this might be a good place to ask:

http://stackoverflow.com/questions/1855884/determine-font-color-based-on-background-color
SplitMon: Window Management SuiteSudoku-It!: An all-in-one Sudoku Generator/Solver

#125 Deamons

Deamons

    Seeker

  • New Members
  • 1 posts

Posted 18 December 2011 - 01:54 PM

Hello FastFrench,

I juste need some information about FastFind.dll, because I developed an application in C# and I recently found your dll, but after including the dll with DllImport, I tried the FFGetPixel function for example, but it always return "-1"

Sample :
        [DllImport(@"....\FastFind.dll")]         static extern int FFGetPixel(int X, int Y, int NoSnapShot);         private void timer1_Tick(object sender, EventArgs e)         {             int pixel = FFGetPixel(Cursor.Position.X, Cursor.Position.Y, 0);             this.Text = pixel.ToString();         }


Do I have to do something with SnapShot function ?

#126 frank10

frank10

    Polymath

  • Active Members
  • PipPipPipPip
  • 217 posts

Posted 04 January 2012 - 08:32 PM

Very good UDF/dll. Very fast.

How do you make a webcam motion detection?
Let's say I have a 640x480 webcam pic and I want to detect if someone opens a door in a vertical position of 100x350 at 70px from the left of window.
I thougth using FFLocalizeChanges, but it compares the entire snapshot and the webcam introduces fuzzy pixels every frame because of noise, so snapshots are always different...

Could you post a code example?

#127 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 05 January 2012 - 10:42 AM

Hello FastFrench,

I juste need some information about FastFind.dll, because I developed an application in C# and I recently found your dll, but after including the dll with DllImport, I tried the FFGetPixel function for example, but it always return "-1"

Sample :

        [DllImport(@"....FastFind.dll")]         static extern int FFGetPixel(int X, int Y, int NoSnapShot);         private void timer1_Tick(object sender, EventArgs e)         {             int pixel = FFGetPixel(Cursor.Position.X, Cursor.Position.Y, 0);             this.Text = pixel.ToString();         }

Do I have to do something with SnapShot function ?

Yes. When you use the AutoIt wrapper, SnapShots are done implicitely as needed. If you use FastFind.dll in some other language like C#, then you have to explicitely make a SnapShot first to use it.

You may check the autoit wrapper (FastFind.au3) to see how to do that.

The log file should give you precious hints on the problem.

Edited by FastFrench, 05 January 2012 - 10:46 AM.


#128 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 05 January 2012 - 10:57 AM

Very good UDF/dll. Very fast.

How do you make a webcam motion detection?
Let's say I have a 640x480 webcam pic and I want to detect if someone opens a door in a vertical position of 100x350 at 70px from the left of window.
I thougth using FFLocalizeChanges, but it compares the entire snapshot and the webcam introduces fuzzy pixels every frame because of noise, so snapshots are always different...

Could you post a code example?

If you want to localize changes in a restricted region, you should better do SnapShots of only that restricted region (rectangle).

But you're right : LocalizeChanges do not handle ShadeVariations, so it has no noise tolerancy.

There are probably many ways to do that. The starting point would be compare a pic with the door opened and another with the door closed. If you have a significative area with a relatively homogeneous color when opened and closed, then
ColorCount should do the job. You need to experiment to find the optimal ShadeVariation value.

Hope this will help,
FF

Edited by FastFrench, 05 January 2012 - 10:58 AM.


#129 frank10

frank10

    Polymath

  • Active Members
  • PipPipPipPip
  • 217 posts

Posted 05 January 2012 - 03:35 PM

I post some pics as an example.
Cam1 is with all doors closed, Cam1_Zones has doorA, doorB and doorC that's not visible.
Cam2 is with DoorB open, Cam3 is with DoorB half-closed, Cam4 is with DoorA open.

I don't think it's possible with ColourCount, because one can check the colourCount of B when closed and it's brown with some shadevariations, but if someone opens it (you can fire this with ColourCount) and leaves B open like Cam2 you can't use the previous ColourCode brown code, because there is no more brown... So you could not detect anymore if someone crosses. And what about someone dressed with similar colour?

I hope to detect if someone enters A and crosses B, or enters from B and crosses C and so on.

I think the best mode should be to compare two adjacent screenshots taken every about 700ms and looking at how many contiguos pixels changed: so if they are a lot contiguos px changed, there was motion in that reported area A, B or C.
This way the webcam noise should not interfere because they are sparse pixels over all the screenshot.
I don't know if this is possible with your udf, up to now.
If it's not possible, I think you could add this feature: it should be a value one for all motion detection uses.

Or maybe another approach could be to flatten the most differences in the colours, making a flat cartoon uniform pic, so eliminating noise, and then compare these screenshots with FFLocalizeChanges.
Like Emboss or Cartoonize.
http://cartoonized.net/tutorial-turning-photograph-into-cartoon-part1.php
But I don't know how to automate this in autoit.

Attached Thumbnails

  • Cam1.jpg
  • Cam1_Zones.jpg
  • Cam2.jpg
  • Cam3.jpg
  • Cam4.jpg
  • Cam1_cartoonized.jpg
  • Cam1_emboss.jpg

Edited by frank10, 05 January 2012 - 03:41 PM.


#130 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 10 January 2012 - 10:09 AM

I post some pics as an example.
Cam1 is with all doors closed, Cam1_Zones has doorA, doorB and doorC that's not visible.
Cam2 is with DoorB open, Cam3 is with DoorB half-closed, Cam4 is with DoorA open.

I don't think it's possible with ColourCount, because one can check the colourCount of B when closed and it's brown with some shadevariations, but if someone opens it (you can fire this with ColourCount) and leaves B open like Cam2 you can't use the previous ColourCode brown code, because there is no more brown... So you could not detect anymore if someone crosses. And what about someone dressed with similar colour?

I hope to detect if someone enters A and crosses B, or enters from B and crosses C and so on.

I think the best mode should be to compare two adjacent screenshots taken every about 700ms and looking at how many contiguos pixels changed: so if they are a lot contiguos px changed, there was motion in that reported area A, B or C.
This way the webcam noise should not interfere because they are sparse pixels over all the screenshot.
I don't know if this is possible with your udf, up to now.
If it's not possible, I think you could add this feature: it should be a value one for all motion detection uses.

Or maybe another approach could be to flatten the most differences in the colours, making a flat cartoon uniform pic, so eliminating noise, and then compare these screenshots with FFLocalizeChanges.
Like Emboss or Cartoonize.
http://cartoonized.net/tutorial-turning-photograph-into-cartoon-part1.php
But I don't know how to automate this in autoit.


I see. Probably the best option would be to have a sort of FFLocalizeChanges with an additional "ShadeVariation" (or noise tolerancy) parameter. May be a good candidat for the next version of FastFind.

For all people that failed to dowload FFshowPixels, could you please try again now ? An admin told me that the link is available now.

Thanks,

FF

#131 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 12 January 2012 - 10:13 AM

Could someone please confirm if ShowPixel can be downloaded (link on 1st post) ?

#132 frank10

frank10

    Polymath

  • Active Members
  • PipPipPipPip
  • 217 posts

Posted 12 January 2012 - 06:30 PM

Yes I downloaded ShowPixel_1.7 (I don't find 1.8)

In your C func, how do you compare the pixel variations?
Do you trasform the pixel region in array and then compare them as strings?

#133 Aktonius

Aktonius

    Prodigy

  • Active Members
  • PipPipPip
  • 182 posts

Posted 12 January 2012 - 09:18 PM

Just want to say that you are beyond awesome FastFrench, thanks for the amazing work!

#134 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 8,834 posts

Posted 12 January 2012 - 10:51 PM

frank10, If I were you I'd put coloured stickers on the doors, and focus the script attentions on those areas.

Perhaps noise might cause some pixels to loo lose credibility but I doubt all of them in that area would.
AutoIt Absolute Beginners Require a serial
Run('hh mk:@MSITStore:'&StringReplace(@AutoItExe,'.exe','.chm')&'::/html/tutorials/helloworld/helloworld.htm','',@SW_MAXIMIZE)

#135 frank10

frank10

    Polymath

  • Active Members
  • PipPipPipPip
  • 217 posts

Posted 12 January 2012 - 11:00 PM

@JohnOne
I could do this if the doors were always closed after each entry.
But when one enters, he can leave the door open, so I could know the door isn't closed but I can't detect anymore if someone crosses again.

EDIT:
Maybe you mean to put these stickers on the doorposts. Yes in that case it could work.
But it's a bit unaestetich...

Edited by frank10, 12 January 2012 - 11:40 PM.


#136 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 8,834 posts

Posted 12 January 2012 - 11:50 PM

Maybe, but even if you focus on a number of pixels anywhere in a particular spot
of a fixed area and only acknowledge the break in continuity if all of them change.
AutoIt Absolute Beginners Require a serial
Run('hh mk:@MSITStore:'&StringReplace(@AutoItExe,'.exe','.chm')&'::/html/tutorials/helloworld/helloworld.htm','',@SW_MAXIMIZE)

#137 CeramicWeasel

CeramicWeasel

    Seeker

  • Active Members
  • 12 posts

Posted 16 January 2012 - 07:43 AM

How about using KeepChanges to blank out everything that hasn't changed, then follow up with BestSpot with a large shade variation that includes everything except black pixels.

With BestSpot, specify something like a 10x10 area with a minimum of 30 matching pixels. This will hopefully be enough to ignore noise and give you a location for the change.

Not perfect, but may work.

You could drastically reduce noise by cartoonizing the snapshot, but you'll never completely eliminate noise with that technique. To do this you could loop through every pixel in the snapshot and "round" it's color to the nearest n'th shade (GetPixel -> Round -> SetPixel), but I don't know how fast that will be.

Edited by CeramicWeasel, 16 January 2012 - 08:24 AM.


#138 frank10

frank10

    Polymath

  • Active Members
  • PipPipPipPip
  • 217 posts

Posted 17 January 2012 - 08:57 PM

Interesting CeramicWeasel, I will try the BestSpot method when I have time. The only problem could be the different color of pixels, but shadeVariation should do the trick.

I thought also to get some orizontal areas in the crossing points and trasform the pixels in Array, then using some string compare method to find how many pixels changed. May work well and also be fast.

#139 CeramicWeasel

CeramicWeasel

    Seeker

  • Active Members
  • 12 posts

Posted 18 January 2012 - 12:10 AM

Actually, NearestSpot should work too, and will be slightly faster since BestSpot will do 2 full searches before it even considers the ShadeVariation parameter.

#140 FastFrench

FastFrench

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 18 January 2012 - 04:20 PM

I fear that on a reasonably noisy 24 bits per pixel picture recording, most - if not all - pixels will change from one picture to another. Even if the change is usually not perceptible, the color will usually not be exactly the same.

I think of a new function that would simply do a "AND" filter on each pixel of a snapShot. It would be very easy to implement and very fast too.
The usage would be :
Filter(SnapShotNb, FilterValue).

For instance, to ignore the 6 low weight bits out of 8 for each color component, the FilterValue would be 0x00C0C0C0. This would make a decent noise filter (this way, you would actually transform your 24 bits per pixel picture into a 64 colors - or 6 bits per pixel - picture).
Another usage would be to split each color channel (Red, Green and Blue) :
the Red SnapShot would come with Filter(SnapShotNb, 0x00FF0000)
the Green one SnapShot would come with Filter(SnapShotNb, 0x0000FF00)
and the blue one with Filter(SnapShotNb, 0x000000FF)


Any use ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users