Giter Club home page Giter Club logo

Comments (7)

mshabunin avatar mshabunin commented on September 23, 2024 2

Example in the documentation is wrong because it doesn't use string. However generally this approach should work:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ["OPENCV_FOR_THREADS_NUM"] = "3"
>>> import cv2
>>> cv2.getNumThreads()
3

Default value without environment change:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.getNumThreads()
4

from opencv.

asmorkalov avatar asmorkalov commented on September 23, 2024 2

Most probably the same as https://stackoverflow.com/questions/5153547/environment-variables-are-different-for-dll-than-exe. It's not related to OpenCV, but OS specific.

from opencv.

dtraparic avatar dtraparic commented on September 23, 2024 1

Dear @LaurentBerger,

I understood the Python Doc but I honestly don't know what to understand in your quoted paragraph. 😕

What I said is that the code provided inside the OpenCV Doc to modify os environment variable, executed as is, raises an error.

The code that reads a video frame doesn't matter much, and it's embedded through MMCV that uses OpenCV, so I'm not able to provide a OpenCV-code-only example. I know this part works, because as I said, it works once the environment variable modified inside Windows parameters.

Please tell me if you really need an example for reading a video frame but I think it's not necessary, as I guess the problem will occur on the set up of every possible OpenCV environment variable.

from opencv.

LaurentBerger avatar LaurentBerger commented on September 23, 2024

first read python doc :

image

I don't see anything in your code about reading a video

from opencv.

clevertension avatar clevertension commented on September 23, 2024

i meet with same problem

from opencv.

LaurentBerger avatar LaurentBerger commented on September 23, 2024

os.environ["MY_ENV_VARIABLE"] = True
True is not a string
and now I search in doc and I found reference:
image
I think you can make a PR to change python code

from opencv.

LaurentBerger avatar LaurentBerger commented on September 23, 2024

I don't understand : opencv documentation is wrong for python
image

there is a bug in opencv documentation because if you follow documentation it raises an execption

from opencv.

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.