Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

feat: implement multiple image detection #212

Merged
merged 11 commits into from
Jan 10, 2021
Merged

feat: implement multiple image detection #212

merged 11 commits into from
Jan 10, 2021

Conversation

khaong
Copy link
Contributor

@khaong khaong commented Jan 5, 2021

Hi,

For my appium use case, there may be multiple places on the screen which has the same image and I'd like to find them all.

I am not a javascript dev by trade, so would definitely welcome any comments on this!

Thanks

Alex

@khaong khaong changed the title Implement multiple image detection feat: implement multiple image detection Jan 5, 2021
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
Performance enhancement - use Mat.at() instead of unnecessary array conversion
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented Jan 6, 2021

Could you please attach a visualized example with multiple matches highlighted?

lib/image-util.js Outdated Show resolved Hide resolved
feat: Add match_neighbour_threshold as option
refactor: make nonzero match loop more succinct
@khaong
Copy link
Contributor Author

khaong commented Jan 6, 2021

Reply: #212 (comment)

I've got a local spec to generate the images

all:
full-highlights

individual:
highlight-0
highlight-1
highlight-2

lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
lib/image-util.js Outdated Show resolved Hide resolved
fix: return all matches visualisation at the top level; multiple is now just an array of occurrences
refactor: filterNearMatches to a more elegant reduce function
lib/image-util.js Outdated Show resolved Hide resolved
@@ -419,6 +423,8 @@ async function getImagesSimilarity (img1Data, img2Data, options = {}) {
* region is highlighted with a rectangle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should mention that this is going to have all matches highlighted when multiple is enabled

@mykola-mokhnach mykola-mokhnach merged commit 49e4ae2 into appium:master Jan 10, 2021
@mykola-mokhnach
Copy link
Contributor

Thanks @khaong , this was a long journey.

Please don't forget to update https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md after the whole implementation is completed

@mykola-mokhnach
Copy link
Contributor

Published in 2.50.0

@khaong
Copy link
Contributor Author

khaong commented Jan 10, 2021

Thank you @mykola-mokhnach for your guidance and your patience with me! I have learnt a lot through the process 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants