OpenCV | Learning OpenCV | Computer Vision library

 by   quarbby Python Version: Current License: No License

kandi X-RAY | OpenCV Summary

kandi X-RAY | OpenCV Summary

OpenCV is a Python library typically used in Artificial Intelligence, Computer Vision, OpenCV applications. OpenCV has no bugs, it has no vulnerabilities and it has low support. However OpenCV build file is not available. You can download it from GitHub.

OpenCV C++ Builds with Qt Support.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              OpenCV has a low active ecosystem.
              It has 4 star(s) with 1 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              OpenCV has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of OpenCV is current.

            kandi-Quality Quality

              OpenCV has no bugs reported.

            kandi-Security Security

              OpenCV has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              OpenCV does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              OpenCV releases are not available. You will need to build from source code and install.
              OpenCV has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed OpenCV and discovered the below as its top functions. This is intended to give you an instant insight into OpenCV implemented functionality, and help decide if they suit your requirements.
            • Blurise an image
            • Gets the gradient of the camera
            • Perform the thresholding algorithm
            • Normalise image
            • White out white balance
            • Convert radians to degrees
            • Finds the contour of the image
            • Get the top left corner of a box
            • Get the box of a given area
            • Check if cnt is a rectangle
            • Creates filter chain image
            • R Check the target X axis
            • Gets the range bearing
            • Convert an image to HSV
            • White balance image
            • Get all centroid from img
            • Compute the morphology of an image
            • Calculate the angle in radians
            • Normalize angle
            Get all kandi verified functions for this library.

            OpenCV Key Features

            No Key Features are available at this moment for OpenCV.

            OpenCV Examples and Code Snippets

            No Code Snippets are available at this moment for OpenCV.

            Community Discussions

            QUESTION

            Blending images without color change?
            Asked 2021-Jun-15 at 21:26

            While studying OpenCV, I realized that whenever I blend two images the colors of scr2 have changed in some way(depends on the colors of scr1).

            I know this is not an informative and clear way to explain my issue, however; I don't know how to describe this issue since I have no expertise with colors so I would like to show you what I meant with images and code.

            The input image: Input image

            ...

            ANSWER

            Answered 2021-Jun-15 at 16:46

            I think I misunderstood your issue. If your issue is that the image where you do not have lines has changed, then that is because you used a white background for scr2. The white then mixes with your image in the output. Make it scr2=img.copy() in place of what you have now. Then try your code. So in Python/OpenCV as a demonstration, using the Lena image as background, here is your code:

            Source https://stackoverflow.com/questions/67989210

            QUESTION

            What is the Sobel operator?
            Asked 2021-Jun-15 at 18:13

            I tried 5 different implementations of the Sobel operator in Python, one of which I implemented myself, and the results are radically different.

            My questions is similar to this one, but there are still differences I don't understand with the other implementations.

            Is there any agreed on definition of the Sobel operator, and is it always synonymous to "image gradient"?

            Even the definition of the Sobel kernel is different from source to source, according to Wikipedia it is [[1, 0, -1],[2, 0, -2],[1, 0, -1]], but according to other sources it is [[-1, 0, 1],[-2, 0, 2],[-1, 0, 1]].

            Here is my code where I tried the different techniques:

            ...

            ANSWER

            Answered 2021-Jun-15 at 14:22

            according to wikipedia it's [[1, 0, -1],[2, 0, -2],[1, 0, 1]] but according to other sources it's [[-1, 0, 1],[-2, 0, 2],[-1, 0, 1]]

            Both are used for detecting vertical edges. Difference here is how these kernels mark "left" and "right" edges.

            For simplicity sake lets consider 1D example, and let array be

            [0, 0, 255, 255, 255]

            then if we calculate using padding then

            • kernel [2, 0, -2] gives [0, -510, -510, 0, 0]
            • kernel [-2, 0, 2] gives [0, 510, 510, 0, 0]

            As you can see abrupt increase in value was marked with negative values by first kernel and positive values by second. Note that is is relevant only if you need to discriminate left vs right edges, when you want just to find vertical edges, you might use any of these 2 aboves and then get absolute value.

            Source https://stackoverflow.com/questions/67987368

            QUESTION

            Read/write Eigen::Matrix with cv::Filestorage
            Asked 2021-Jun-15 at 15:05

            According to the OpenCV Docs, we can use cv::FileStorage to read/write custom data structure from/to config files (XML, YAML, JSON):

            ...

            ANSWER

            Answered 2021-Jun-15 at 15:05

            The issue is due to the intruduction of namespace, indeed you can get a similar issue with this code:

            Source https://stackoverflow.com/questions/67985606

            QUESTION

            How does the "compressed form" of `cv::convertMaps` work?
            Asked 2021-Jun-14 at 23:34

            The documentation for convertMaps says that it supports the following transformation:

            (CV_32FC1, CV_32FC1)→(CV_16SC2, CV_16UC1) This is the most frequently used conversion operation, in which the original floating-point maps (see remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false) contains indices in the interpolation tables.

            I understand that (CV_32FC1, CV_32FC1) is encoding (x, y) coordinates as floats. How does the fixed point format work? What is encoded in each 2-channel entry of the CV_16SC2 matrix? What interpolation tables does the CV_16UC1 matrix index into?

            ...

            ANSWER

            Answered 2021-Jun-14 at 23:34

            I'm going by what I remember from the last time I investigated this. Grain of salt and all that.

            the fixed point format splits the integer and fractional parts of your (x,y)-coordinates into different maps.

            it's "compact" in that CV_32FC2 or 2x CV_32FC1 uses 8 bytes per pixel, while CV_16SC2 + CV_16UC1 uses 6 bytes per pixel. also it's integer-only, so using it can free up floating point compute resources for other work.

            the integer parts go into the first map, which is 2-channel. no surprises there.

            the fractional parts are converted to 5-bit integers, i.e. they're multiplied by 32. then they're packed together, lowest 5 bits from one coordinate, higher next 5 bits from the other one.

            the resulting funny number has a range of 0 .. 1023, or 0b00000_00000 .. 0b11111_11111, which encodes fractional parts (0.0, 0.0) and (0.96875, 0.96875) respectively (that's 31/32).

            during remap...

            the integer map is used to look up, for every resulting pixel, several pixels in the source image required for interpolation.

            the fractional map is taken as an index into an "interpolation table", which is internal to OpenCV. it contains whatever factors and shifts required to correctly blend the several sampled pixels into one resulting pixel, all using integer math. I guess there are multiple tables, one for each interpolation method (linear, cubic, ...).

            Source https://stackoverflow.com/questions/67939327

            QUESTION

            Is there a metric to quantify the perspectiveness in two images?
            Asked 2021-Jun-14 at 16:59

            I am coding a program in OpenCV where I want to adjust camera position. I would like to know if there is any metric in OpenCV to measure the amount of perspectiveness in two images. How can homography be used to quantify the degree of perspectiveness in two images as follows. The method that comes to my mind is to run edge detection and compare the parallel edge sizes but that method is prone to errors.

            ...

            ANSWER

            Answered 2021-Jun-14 at 16:59

            As a first solution I'd recommend maximizing the distance between the image of the line at infinity and the center of your picture.

            Identify at least two pairs of lines that are parallel in the original image. Intersect the lines of each pair and connect the resulting points. Best do all of this in homogeneous coordinates so you won't have to worry about lines being still parallel in the transformed version. Compute the distance between the center of the image and that line, possibly taking the resolution of the image into account somehow to make the result invariant to resampling. The result will be infinity for an image obtained from a pure affine transformation. So the larger that value the closer you are to the affine scenario.

            Source https://stackoverflow.com/questions/67963004

            QUESTION

            calling a __host__ function from a __host__ __device__ functon is not allowed
            Asked 2021-Jun-14 at 14:06

            I am trying to use thrust with Opencv classes. The final code will be more complicated including using device memory but this simple example does not build successfully.

            ...

            ANSWER

            Answered 2021-Jun-14 at 14:06

            As pointed out in the comments, for the code you have shown, you are getting a warning and this warning can be safely ignored.

            For usage in CUDA device code:

            For a C++ class to be usable in CUDA device code, any relevant member functions that will be used explicitly or implicitly in CUDA device code, must be marked with the __device__ decorator. (There are a few exceptions e.g. for defaulted constructors which don't apply here.)

            The OpenCV class you are attempting to use (cv::KeyPoint), doesn't meet these requirements for use in device code. It won't be usable as-is.

            There may be a few options:

            1. Recast your work using cv::KeyPoint to use some class that provides similar functionality, that you write yourself, in such a way as to be properly designed and decorated.

            2. Perhaps see if OpenCV built with CUDA has an alternate version here (properly designed/decorated) (my guess would be it probably doesn't)

            3. Rewrite OpenCV itself, taking into account all necessary design changes to allow the cv::KeyPoint class to be usable in device code.

            4. As a variant of suggestion 1, copy the relevant data .response to a separate set of classes or just a bare array, and do your selection work based on that. The selection work done there can be used to "filter" the original array.

            Source https://stackoverflow.com/questions/67966538

            QUESTION

            Error message when trying to resize with cv2.resize
            Asked 2021-Jun-14 at 07:11

            I'm trying to load a .npy file and resize it with cv2.resize but I get the following error message:

            cv2.error: OpenCV(4.5.1-dev) /home/name/opencv_build/opencv/modules/imgproc/src/resize.cpp:3688: error: (-215:Assertion failed) !dsize.empty() in function 'resize'

            This is my code:

            ...

            ANSWER

            Answered 2021-Jun-14 at 07:05

            images in opencv should only have 2 dim if grayscale/single channel or 3 dim if color. you seem to have a gray/single channel image [192,640] thats wrapped in 2 lists [1,1,---]

            so to get the image you need to get it from inside those 2 lists.

            img = np.load(filepath)[0][0]

            or if you are not sure how many lists its wrapped in, you can do

            img = np.squeeze(np.load(filepath)

            but that will work as long as there is only 1 image in those lists

            Source https://stackoverflow.com/questions/67962369

            QUESTION

            Shape of corners array returned by findChessboardCorners()
            Asked 2021-Jun-14 at 06:34

            I'm using the OpenCV function findChessboardCorners() successfully, but I'm confused by the shape of the corners return value.

            Here is my code below. I already know that my chessboard image has 8 x 6 internal corners.

            ...

            ANSWER

            Answered 2021-Jun-14 at 06:34

            It is an unwanted and unnecessary dimension, you can eliminate the dimension by using the squeeze function of numpy:

            Source https://stackoverflow.com/questions/67964604

            QUESTION

            Recognizer.read('trainer/trainer.yml) could not find trainer.yml file
            Asked 2021-Jun-13 at 04:10

            I'm trying to run this code but it did not because I am not able to download this file from GitHub. Is there anyone who knows how I can download this file?

            This is the link to the file with the filename face-trainner.yml: https://github.com/codingforentrepreneurs/OpenCV-Python-Series/tree/…

            I'm getting this error when running my program:

            ...

            ANSWER

            Answered 2021-Jun-12 at 21:14

            Go to the main section of the GitHub repository: https://github.com/codingforentrepreneurs/OpenCV-Python-Series

            1. Press the code button and then download as zip.
            2. Unzip the file in your downloads.
            3. Navigate to src/recognisers and the file face-trainner.yml should be there.
            4. Use that file how you want in your project (discard of the rest if you have no need for it).

            Also make sure that you have typed the correct file name in your program with the two 'n's (face-trainner.yml not face-trainer.yml)

            Source https://stackoverflow.com/questions/67952870

            QUESTION

            OpenCV haarCascade whit Optical flow tracking
            Asked 2021-Jun-12 at 22:56

            i'm trying to track objects with Optical flow in android after using a Haar Cascade detection like in the code below and i have this error can anyone help me with this

            E/cv::error(): OpenCV(3.4.12) Error: Assertion failed ((npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0) in virtual void cv::{anonymous}::SparsePyrLKOpticalFlowImpl::calc(cv::InputArray, cv::InputArray, cv::InputArray, cv::InputOutputArray, cv::OutputArray, cv::OutputArray), file /build/3_4_pack-android/opencv/modules/video/src/lkpyramid.cpp, line 1259 E/org.opencv.video: video::calcOpticalFlowPyrLK_15() caught cv::Exception: OpenCV(3.4.12) /build/3_4_pack-android/opencv/modules/video/src/lkpyramid.cpp:1259: error: (-215:Assertion failed) (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 in function 'virtual void cv::{anonymous}::SparsePyrLKOpticalFlowImpl::calc(cv::InputArray, cv::InputArray, cv::InputArray, cv::InputOutputArray, cv::OutputArray, cv::OutputArray)' E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: opencv.org, PID: 31380 CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.12) /build/3_4_pack-android/opencv/modules/video/src/lkpyramid.cpp:1259: error: (-215:Assertion failed) (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 in function 'virtual void cv::{anonymous}::SparsePyrLKOpticalFlowImpl::calc(cv::InputArray, cv::InputArray, cv::InputArray, cv::InputOutputArray, cv::OutputArray, cv::OutputArray)' ]

            ...

            ANSWER

            Answered 2021-Jun-12 at 22:56

            matPrevGray is empty. that's what it's saying.

            Source https://stackoverflow.com/questions/67950231

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install OpenCV

            You can download it from GitHub.
            You can use OpenCV like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/quarbby/OpenCV.git

          • CLI

            gh repo clone quarbby/OpenCV

          • sshUrl

            git@github.com:quarbby/OpenCV.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link