OpenCV | The OpenCV Java project for Android | Android library

 by   vRallev Java Version: Current License: Non-SPDX

kandi X-RAY | OpenCV Summary

kandi X-RAY | OpenCV Summary

OpenCV is a Java library typically used in Mobile, Android, OpenCV, Gradle applications. OpenCV has low support. However OpenCV has 10 bugs, it has 15 vulnerabilities, it build file is not available and it has a Non-SPDX License. You can download it from GitHub.

~~The OpenCV library for Android as Gradle project.~~. All credit goes to I’ve took their library and exported it as .aar library. Now you can easily use OpenCV in a Gradle / Android Studio project.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              OpenCV has a low active ecosystem.
              It has 268 star(s) with 90 fork(s). There are 22 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 5 have been closed. On average issues are closed in 114 days. 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 10 bugs (0 blocker, 0 critical, 7 major, 3 minor) and 6743 code smells.

            kandi-Security Security

              OutlinedDot
              OpenCV has 15 vulnerability issues reported (0 critical, 10 high, 5 medium, 0 low).
              OpenCV code analysis shows 0 unresolved vulnerabilities.
              There are 8 security hotspots that need review.

            kandi-License License

              OpenCV has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            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.
              OpenCV saves you 5688 person hours of effort in developing the same functionality from scratch.
              It has 11898 lines of code, 2583 functions and 95 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            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.
            • Computes the fundamental matrix for the given points
            • Calculates the Fundamental matrix from two points
            • Calculates the fundamental matrix which should be used to represent the fundamental points of the two points
            • Determines the contours of the binary image
            • Determine the contours of the binary image
            • Draw contour
            • Gets the circles
            • Computes a 2D histogram for the given colors
            • Computes the optical flow for a sparse feature set
            • Calculates the optical flow for a sparse feature set
            • Computes the Hough circles
            • Computes a histogram for the given arrays
            • Detects lines inside a binary image
            • Convenience method to perform a forward Fourier Transform of a floating point array
            • Returns the line segments of a binary image
            • Computes the DFT transform
            • Registers a new package
            • Rectify 3 matrices
            • Predicts a label for a given image
            • Converts a vector to a matrix
            • Convert a Vector to a Matcher
            • Calculates the hash code
            • Training a Firmata model
            • Calculates the size of a text box
            • Saves an image to a file
            • Convert key points to mat
            • Delivers the camera frame
            • Called when the manager is connected
            • Mix two channels
            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

            In OpenCV 3.3.1, a heap-based buffer overflow happens in cv::Jpeg2KDecoder::readComponent8u in modules/imgcodecs/src/grfmt_jpeg2000.cpp when parsing a crafted image file.
            An issue was discovered in OpenCV before 3.4.7 and 4.x before 4.1.1. There is an out of bounds read/write in the function HaarEvaluator::OptFeature::calc in modules/objdetect/src/cascadedetect.hpp, which leads to denial of service.
            ** DISPUTED ** The validateInputImageSize function in modules/imgcodecs/src/loadsave.cpp in OpenCV 3.4.1 allows remote attackers to cause a denial of service (assertion failure) because (pixels <= (1<<30)) may be false. Note: “OpenCV CV_Assert is not an assertion (C-like assert()), it is regular C++ exception which can raised in case of invalid or non-supported parameters.”
            ** DISPUTED ** The validateInputImageSize function in modules/imgcodecs/src/loadsave.cpp in OpenCV 3.4.1 allows remote attackers to cause a denial of service (assertion failure) because (size.width <= (1<<20)) may be false. Note: “OpenCV CV_Assert is not an assertion (C-like assert()), it is regular C++ exception which can raised in case of invalid or non-supported parameters.”
            ** DISPUTED ** The validateInputImageSize function in modules/imgcodecs/src/loadsave.cpp in OpenCV 3.4.1 allows remote attackers to cause a denial of service (assertion failure) because (size.height <= (1<<20)) may be false. Note: “OpenCV CV_Assert is not an assertion (C-like assert()), it is regular C++ exception which can raised in case of invalid or non-supported parameters.”
            An issue was discovered in OpenCV 4.1.0. There is a divide-by-zero error in cv::HOGDescriptor::getDescriptorSize in modules/objdetect/src/hog.cpp.
            An exploitable heap buffer overflow vulnerability exists in the data structure persistence functionality of OpenCV 4.1.0. A specially crafted XML file can cause a buffer overflow, resulting in multiple heap corruptions and potential code execution. An attacker can provide a specially crafted file to trigger this vulnerability.
            An exploitable heap buffer overflow vulnerability exists in the data structure persistence functionality of OpenCV, before version 4.2.0. A specially crafted JSON file can cause a buffer overflow, resulting in multiple heap corruptions and potentially code execution. An attacker can provide a specially crafted file to trigger this vulnerability.
            An out-of-bounds read was discovered in OpenCV before 4.1.1. Specifically, variable coarsest_scale is assumed to be greater than or equal to finest_scale within the calc()/ocl_calc() functions in dis_flow.cpp. However, this is not true when dealing with small images, leading to an out-of-bounds read of the heap-allocated arrays Ux and Uy.
            OpenCV 4.1.1 has an out-of-bounds read in hal_baseline::v_load in core/hal/intrin_sse.hpp when called from computeSSDMeanNorm in modules/video/src/dis_flow.cpp.
            An issue was discovered in OpenCV before 3.4.7 and 4.x before 4.1.1. There is an out of bounds read in the function cv::predictOrdered<cv::HaarEvaluator> in modules/objdetect/src/cascadedetect.hpp, which leads to denial of service.
            OpenCV (Open Source Computer Vision Library) through 3.3 has a denial of service (CPU consumption) issue, as demonstrated by the 11-opencv-dos-cpu-exhaust test case.
            OpenCV (Open Source Computer Vision Library) through 3.3 has a denial of service (memory consumption) issue, as demonstrated by the 10-opencv-dos-memory-exhaust test case.
            In OpenCV 3.3.1, a heap-based buffer over-read exists in the function cv::HdrDecoder::checkSignature in modules/imgcodecs/src/grfmt_hdr.cpp.
            In OpenCV 3.3.1, an assertion failure happens in cv::RBaseStream::setPos in modules/imgcodecs/src/bitstrm.cpp because of an incorrect integer cast.

            Install OpenCV

            You can download it from GitHub.
            You can use OpenCV like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the OpenCV component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            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/vRallev/OpenCV.git

          • CLI

            gh repo clone vRallev/OpenCV

          • sshUrl

            git@github.com:vRallev/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