Coder Social home page Coder Social logo

Comments (13)

xiety avatar xiety commented on June 8, 2024 1

I'm doing a simple test:

from vidgear.gears import ScreenGear
capture_options = {"top": 100, "left": 100, "width": 700, "height": 700}
screen = ScreenGear(**capture_options).start()
image = screen.read()
print(image.shape)

The result is (600, 600, 3) instead of (700, 700, 3). The same with mss backend.

from vidgear.

welcome avatar welcome commented on June 8, 2024

Thanks for opening this issue, a maintainer will get back to you shortly!

In the meantime:

  • Read our Issue Guidelines, and update your issue accordingly. Please note that your issue will be fixed much faster if you spend about half an hour preparing it, including the exact reproduction steps and a demo.
  • Go comprehensively through our dedicated FAQ & Troubleshooting section.
  • For any quick questions and typos, please refrain from opening an issue, as you can reach us on Gitter community channel.

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

@xiety This is not a bug. VidGear follows pillow's Coordinate System which states as follows:

The Python Imaging Library uses a Cartesian pixel coordinate system, with (0,0) in the upper left corner. Note that the coordinates refer to the implied pixel corners; the centre of a pixel addressed as (0, 0) actually lies at (0.5, 0.5).

Coordinates are usually passed to the library as 2-tuples (x, y). Rectangles are represented as 4-tuples, (x1, y1, x2, y2), with the upper left corner given first.

That would look like this:

image

Pillow's XY coordinate system, which is different from what you're targeting for. Kindly make changes according to it.

from vidgear.

xiety avatar xiety commented on June 8, 2024

@abhiTronix, I'm sorry, but I can't understand why I need to put x coordinate into the top property and not into the left

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

image
Hope this image helps you.

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

I never said it should x or y, it is distance from top.

from vidgear.

xiety avatar xiety commented on June 8, 2024

But the fact of the matter is that now in the top property you need to put the distance from the left edge of the screen.

from vidgear.

xiety avatar xiety commented on June 8, 2024

diagram copy2

This is how it is working now, which is kinda strange

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

@xiety let me check.

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

@xiety Yes "top" and "left" were swapped for dxcam backend. But your diagram is incorrect, height and is not from the initial(0,0) but from the top+height and left+width respectively, you can confirm this by setting top and left zero and then increasing both the values simultaneously and you could see region moving diagonally, but the dimensions(area) of region not changing.

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

@xiety Apologies, visually this is really hard to see. Yeah you're correct, since all those backend libraries are following PIL.ImageGrab.grab bbox left,upper,right,lower conventions as explained in depth here: http://chayanvinayak.blogspot.com/2013/03/bounding-box-in-pilpython-image-library.html

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

@xiety I'll add this to ScreenGear documentation.

from vidgear.

abhiTronix avatar abhiTronix commented on June 8, 2024

Successfully resolved and merged in commit 3c0dd5d

from vidgear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.