opencv-cpp | repository consists of a bunch of OpenCV programs | Computer Vision library
kandi X-RAY | opencv-cpp Summary
kandi X-RAY | opencv-cpp Summary
This repository consists of a bunch of OpenCV programs written in C++, which includes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of opencv-cpp
opencv-cpp Key Features
opencv-cpp Examples and Code Snippets
Community Discussions
Trending Discussions on opencv-cpp
QUESTION
Following is a code I found here for real time object tracking:
...ANSWER
Answered 2021-Jan-27 at 05:48your if statement has the parenthesis in the wrong place
QUESTION
I need to selec a ROI (region of interest), or work area, on a live video from my webcam and take a snapshot of ONLY this work area or ROI, but I can't found how to do this.
In this page https://www.learnopencv.com/how-to-select-a-bounding-box-roi-in-opencv-cpp-python/ have a code for draw a ROI but only with images, not a live video.
...ANSWER
Answered 2019-Jun-06 at 04:29Here's a widget to select static ROIs from a video frame. Essentially the idea is to use cv2.setMouseCallback()
and event handlers to detect if the mouse has been clicked or released. For this implementation, you can extract coordinates by holding down the left mouse button and dragging to select the desired ROI. You can reset the ROI using the right mouse button. To use the widget, press c
to pause the video and start cropping. Then you are free to select the ROI. Once you have selected your ROI, press c
again to crop the desired section. To resume the video, press r
.
QUESTION
Alpha blending in same size two images is explained here. How do we implement this for two different size images. Ex: 600x400 pixels PNG for foreground and a 700x380 pixels JPG for background. In the mentioned link, Both the images are same size.
...ANSWER
Answered 2019-May-02 at 18:32First of, resizing is a bad idea. Unless both images are resized together (which won't solve the problem), resizing will change the final result in undesired ways (e.g. the foreground object will appear larger than intended).
Alpha blending is usually used to add foreground elements to a background image. Therefore, I would fix the size of the background image, and consider it also the output image size. In applications, one might need to have the foreground exit the background image, but that is a specific application which requires more input (how to extend the background borders?).
Since the background image has a fixed size, we need a way to handle the alpha blending of a smaller image. Consider the simplified case, where the smaller (foreground) image is aligned with the larger (background) image at the point (0,0). Then, you can iterate over the background image, check if it overlaps the foreground image, and if it does, blend them.
Solving the general cases introduces another problem: positioning. You need to know where to place the foreground element. This requires some additional input.
Given a smaller image and a position where you want to place it, you can alpha blend against a larger image using an algorithm as follows:
QUESTION
I need the xy horizontal projection of two objects in a video. I have complete control of the environment so I am putting the camera centred on top. (I am not interested in the video itself, but from the video I also get the measures to calibrate the track to proper units).
I am thinking in using one of the implemented tracking algorithms in opencv. I've been playing around with them running the example codes with sample videos and work more than fine.
My first and very main question is: What is the best marker I can use given that I have the freedom to choose? I was thinking that bright LED's is most likely the easiest. But I am not sure given that this algorithms might work better with complex shapes or objects with more features. Could QR codes work better? The marker would move and tilt that's why I am not certain. The light sounds good and quite robust to tilting.
The second question, which actually is probably interdependent with the first one, is: What is the best tracking algorithm for this scenario? I was reading a bit online. A very nice summary of the tracking methods available is https://www.learnopencv.com/object-tracking-using-opencv-cpp-python/ from where I thought I should use KCF tracker. But, I haven't dig that much into the algorithms and I think I might be using not compatible ideas: like, tracking a color is probably simple in the sense that can be done just by some color filtering and based on the speed use some prediction, etc. But maybe this algorithms that detect many features don't really work well with just a light.
So, again, I guess the question might be reformulated as: what is the best marker/tracking algorithm combination in my particular scenario?
...ANSWER
Answered 2019-Apr-23 at 16:41Those tracking algorithms are for tracking complex patterns, like a face in a video where the lighting changes, and the direction of the head is changing. If in you application you can use color or light to mark your object uniquely, then that will be the fastest algorithm and simplest. if you need very precise localization, then you need to consider using a marker, the reason is that a marker allows sub-pixel localization.
QUESTION
I want to create a script which takes a .HDR
file and tonemaps it into a .JPG
. I have looked at a few OpenCV tutorials and it seems it should be able to do this.
I have written this script:
...ANSWER
Answered 2019-Feb-12 at 21:41You were almost there, except for two small mistakes.
The first mistake is using cv2.imread
to load the HDR image without specifying any flags. Unless you call it with IMREAD_ANYDEPTH
, the data will be downscaled to 8-bit and you lose all that high dynamic range.
When you do specify IMREAD_ANYDEPTH
, the image will be loaded as 32bit floating point format. This would normally have intensities in range [0.0, 1.0], but due to being HDR, the values exceed 1.0 (in this particular case they go up to about 22). This means that you won't be able to visualize it (in a useful way) by simply casting the data to np.uint8
. You could perhaps normalize it first into the nominal range, or use the scale and clip method... whatever you find appropriate. Since the early visualization is not relevant to the outcome, I'll skip it.
The second issue is trivial. You correctly scale and clip the tone-mapped image back to np.uint8
, but then you never use it.
Script
QUESTION
I was reading this post to calculate the center of an image using OpenCV
which uses Moments
. But I am trying to calculate the center of an object I detected using HoughLinesP. Is there a way with OpenCV I could do this?
Here is the image for which I am trying to calculate the centers.
The line segments were found and the output image looks like:
...ANSWER
Answered 2019-Jan-27 at 18:57The following code was used with cv2
version of 3.3.1
.
I closely followed the opencv docs and it worked fine.
QUESTION
I am setting up a ros system to publish images with ros, c++ and opencv-2 for my drone. The code, below, is publishing raw images. While publishing, I want to write gray-scale images frame-by-frame with resolution of 1280 x 720 to record a video. I have found a readily available video writing code with opencv. However, I could not incorporate this code into image_publisher code. Here is the image_publisher code:
...ANSWER
Answered 2019-Jan-04 at 12:47You cannot send opencv Mat inside ros topic system since Image
topic has another coding system.
You need to use cv_bridge
to convert images that you got from Opencv to ROS-image Format
there are some details and examples Here
QUESTION
I'm trying to use opencv to do some automatization but I need the camera's feed. The problem is now that everything works, i can't have an image that has a meaning...
I tried with a simple program using picamera to check if it was from my camera, it's not..
...ANSWER
Answered 2018-Dec-24 at 01:41To work with picamera, I recommend you to use the package picamera
. You can follow this tutorial to deploy picamera: https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install opencv-cpp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page