Python Forum
What is the best way to search for a pixel in a screenshot?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the best way to search for a pixel in a screenshot?
#2
I would recommend the follwoing approach instead of using loops directly:
# image.shape = (height, width, colors)
# pixel = np.array([R, G, B]), i.e.numpy array of length <the number of colors>
# threshold -- scalar value, takes into account color similarity 
np.where((np.abs(pixel - image) < threshold).all(axis=-1))
Reply


Messages In This Thread
RE: What is the best way to search for a pixel in a screenshot? - by scidam - May-15-2020, 12:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Voxel to pixel graphics voicemail 3 593 Nov-19-2023, 09:45 AM
Last Post: paul18fr
  Pixel color and action Sartre 4 2,131 Apr-13-2023, 03:26 AM
Last Post: Sartre
  Dynamic pixel display jerryf 2 744 Mar-17-2023, 07:26 PM
Last Post: jerryf
  Plotting Pixel Intensity Doev 0 1,744 Oct-21-2020, 10:56 PM
Last Post: Doev
  IEDriverServer screenshot ABVSVL 0 1,744 Jul-12-2020, 09:31 AM
Last Post: ABVSVL
  pyautogui.screenshot region is not working alexlu 6 6,555 Jun-04-2020, 10:46 AM
Last Post: alexlu
  Want to take a Screenshot from a File in Linux dhiliptcs 2 2,575 Oct-21-2019, 01:22 PM
Last Post: dhiliptcs
  Fast get pixel and oparate. storzo 7 7,134 Aug-26-2019, 07:36 PM
Last Post: Larz60+
  Screenshot of specific window kainev 10 19,381 Nov-30-2018, 03:07 PM
Last Post: kainev
  datetime with every screenshot name evilcode1 7 5,550 Aug-27-2018, 06:01 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020