Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [opencv]

OpenCV (Open Source Computer Vision) is a cross-platform library of programming functions for real time computer vision.

6
votes
1answer
162 views

Trimming blank space from images

I am working on scanned documents (ID card, Driver licenses, ...). The problem I faced while I apply some preprocessing on them is that the documents occupy just a small area of the image, all the ...
2
votes
0answers
41 views

Extracting face features from selfies faster

My code takes two .jpg files (two selfies) and extracts a vector of 128 features from each selfie. After this extraction we take these two vectors and get their cosine distance. I timed the script ...
3
votes
1answer
137 views

Image pre-processing and segmentation

I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning". I applied the following techniques: 1)...
1
vote
0answers
66 views

Image capture client - multi-threading + sharing data between services

I'm working on a small side project at the moment - like a homemade CCTV system. This part is my Python Capture Client - it uses OpenCV to capture frames from a connected webcam and sends the frames ...
0
votes
0answers
36 views

An image template matching app

I made a simple template matching app and was wondering if there are any improvements to be made with the code The way I have it set up is it processes every 50 frames (to speed up the program ...
2
votes
1answer
88 views

Optimizing gradient function in C++

I'm computing the gradient of an image manually (without using built in functions) and I want to make it faster but keeping the same performance. I'm very open to any suggestions.. currently learning ...
6
votes
1answer
181 views

Rotating an Image using own algorithm in python

For an uni assignment I have been giving the task of making my own rotating algorithm in python. This is my code so far. ...
4
votes
2answers
288 views

Passing bitmap from C# to C++ via a struct

First, I've read the a few questions regarding this issue, the most helpful being: https://stackoverflow.com/questions/27463876/passing-bitmap-from-c-sharp-to-c I was unable to get the provided ...
4
votes
1answer
76 views
3
votes
2answers
103 views

Testing Video Frames for Uniqueness

I'm working on a program that will (hopefully) eventually allow me to perform frame rate analysis like Digital Foundry does. The code below works (as far as I know), but before I iterate on it, I'd ...
2
votes
0answers
313 views

Real time object Detection and tracking

I am using OpenCV 3.3 to implement a project. My project allows to detect pedestrian and car using background subtraction from video sequence which get from camera. First, I detect the object region ...
2
votes
1answer
156 views

Image processing using Python OOP library

I am trying to learn OOP by refactoring my existing code (functions only). This example works but I am not sure whether it is pythonic and good practice. I have a shared library which consist of ...
3
votes
0answers
49 views

Data set generation with Python and Matplotlib

I want to use Python and Matplotlib to create a data set of images. I want to do this by transforming the plot to a numpy matrix. At the moment it takes about 0.1 second to generate 100 images of size ...
4
votes
1answer
241 views

Parallelized Sobel algorithm using OpenMP

I implemented the Sobel algorithm sequentially, and got decent performance (1.49 s) but wanted to improve it. I parallelized it with OpenMP and got a ~3x speedup (0.523 s). I'd like to do better, but ...
13
votes
0answers
224 views

Efficiently selecting spatially distributed weighted points

Background: Motivation behind writing the following code is originated in the area of computer vision. More specifically – image rectification. In order to obtain rectified images, one has to find a ...
1
vote
1answer
286 views

Multithread resource producer and consumer algorithm

I have made a little example of a code that stores frames of a camera in a buffer that runs in a separate thread and another thread can consume it. Is this model efficient? ...
9
votes
1answer
6k views

Looping over pixels in an image

I have the following code which iterates over all pixels of an image and does some manipulations on two images of the same size. I would like to speed it up and to avoid iterating over the positions ...
9
votes
1answer
563 views

Converting MP3 albums into MP4 videos for YouTube

This is a quick script that helps me to convert MP3 files from my CDs into videos I can upload on YouTube. It is intended for personal use, so no input error checks. I am creating a silent video using ...
1
vote
0answers
519 views

OpenCV multi-colored object tracking

These two classes are part of a larger program that I am developing. The user is supposed to interact with the program using handheld red, blue, green or yellow discs and moving them in front of a ...
3
votes
2answers
481 views

Image processing parallelization

I'm working in a big project so I decided to take just part of it which you can copy/paste and compile in your machine. You might get weird image at the end but that's fine, that's what I want. I'm ...
1
vote
1answer
60 views

Set of matrix operations for summing around a matrix element

I have a results of simulations, which are discrete complex numbers representing wave function on a NxN grid. I calculate phase of the wavefunction. For every point on that grid I have to perform this ...
14
votes
3answers
8k views

Processing an image to extract green-screen mask

I am using OpenCV to process an image, and in my code, I have to check / edit each pixel separately: ...
4
votes
0answers
49 views

Improving SVM fitting accuracy

I have this attempt on classifying CIFAR10 images. I'm curently training my SVM only on 1 of 5 sets, and decided on using polynomial kernel(degree=3,C=0.1 [changes have no effect],gamma=2 [changes ...
1
vote
0answers
746 views

Opencv forEach with lambda expression for parallel processing

I'm using forEach function to access pixels in parallel like so: ...
1
vote
0answers
101 views

Performing FFTW double[2] on images of type cv::Mat

I've two different types of variables: cv::Mat and array of type double[2] so I do quite lot of copying between the two types. I ...
2
votes
0answers
254 views

OpenCV numpy image tranformation efficiency

I am doing a few image transformations - resize, offset, and crop. I am doing all these operations separately, but I feel like they can be better combined to get a speed improvement. This is happening ...
2
votes
0answers
602 views

Optimize GPU usage for real-time object detection from camera with TensorFlow GPU and OpenCV

Trying to recognize objects real time using TensorFlow Object Detection API OpenCV using ssd_mobilenet_v1_coco_11_06_2017 model in GPU. ...
4
votes
1answer
6k views

OpenCV motion detection and tracking

I've been tinkering with Python and OpenCV for a while now, and thought I'd start an actual project. This is my first time making something that I'd actually consider using, and my first time posting ...
6
votes
1answer
591 views

Solver for some simple tangrams

I decided to write a program to solve Tangram puzzles. This went a bit out of hand and I ended up with 600+ lines of code. I don't think it should have taken so much code. Here is an image of a ...
3
votes
1answer
3k views

Saving images using Opencv in python

Is there a better way to rewrite this part in python. It doesnot have to be shorter as long as its much better. thanks in advance ...
4
votes
1answer
463 views

Python API for simple OpenCV image proc, called with JSON inputs

Background I've got OpenCV & Python installed on a Docker container which is on a http server to process images and serve them. The user interface is through the web; user inputs an image and ...
6
votes
1answer
123 views

Simple application in Python using OpenCV for face

I have been working on a simple Python application for face recognition with OpenCV. My code does its work and gets the job done, but I'm wondering if there's a 'better' way to do this. I hope I can ...
4
votes
3answers
4k views

Create a two-dimensional Gaussian kernel

In my code I have a function that generate a 2D gaussian function given sigma like so: ...
1
vote
1answer
2k views

Finding the 20th percentile pixel of an image using a histogram instead of std::sort

I have a 2-dimensional matrix (an image) in which I need to find the 20th percentile value. My first attempt was to sort the values and then index using ...
2
votes
0answers
23k views

Python video streaming server and client

Worked with same IP cameras for some time, and noticed that camera use much processing power because of multiple connections. Writing streaming server looked as nice solution so I decided to write my ...
1
vote
1answer
496 views

Color scale in range

I need to select a color given a position within a range. Using the "bwr" colormap shown below, I want to return a blue color for a value at the beginning of the range, a red color for a value at the ...
5
votes
1answer
297 views

C++ multiple object recognition

I am working on a multi-object recognition program. I have succeeded recognising two objects. However, the speed of my program is really slow and laggy. Can somebody please tell a way to speed the ...
3
votes
0answers
837 views

Send Opencv::Mat image from Qt application to HTML client, using websocket

I wrote an application in C++ using Qt 5.7, basically is a websocket server, using qwebsocket for this, capable to send an image elaborated with OpenCV to an HTML client. In order to do this I encode ...
6
votes
0answers
244 views

Simple AR Tag classifier

I have been working on creating a simple AR Tag classifier, for detecting a simple AR Tag glyph. Spitting out an image that looks like this: With the red circle indicating the corner closest to the ...
4
votes
0answers
2k views

Capture, display, and save webcam video with openCV using C++

The basics were taken from one of the more basic OpenCV examples. Any comments are welcome regarding style and conventions, etc., as well as tips on using the OpenCV library, which I'm new to. Also, ...
8
votes
1answer
178 views

Vision AI using OpenCV

I know this may sound dumb, but last time, I posted C++ code, similar to this one: This is just something to get me closer to actually doing a neural network. This code is supposed to learn colors ...
7
votes
1answer
514 views

Motion detection program for snapping of images

I'm doing a motion detection program where it snaps an image when it detects movement and snaps an image of the person's face if in view while this is all recorded and sends it all to Dropbox. It's ...
13
votes
1answer
3k views

Streaming H264 video from PiCamera to a JavaFX ImageView

I'm currently working on a robotics application where a video feed is being displayed from a Raspberry Pi 3. I've been working on a way to stream the video directly into JavaFX (the rest of the UI is ...
8
votes
2answers
1k views

Color guessing code

This code is supposed to learn colors from many many data images, and then recognize color using an algorithm that I made. Eventually, I want the program to make its own algorithm. Data input and ...
4
votes
0answers
269 views

Plant/Residue Detection project, How to structure it?

Introduction I have wanted to develop this project for more than two years. I just started writing it a couple days ago. I use it to detect plant or residue pixels in crop row images but it provides ...
1
vote
1answer
3k views

Cropping faces from images in a directory

I am using the below code for cropping faces from images in a directory ...
3
votes
1answer
94 views

Color thresholding function

I wrote an adaptive color thresholding function in Python (because OpenCV's cv2.adaptiveThreshold didn't fit my needs) and it is way too slow. I've made it as efficient as I can, but it still takes ...
1
vote
0answers
1k views

Utilizing Moviepy's fl_image function efficiently to modify an incoming video

This is a followup question from this question of mine. I used the suggested function provided by an answer in my current code. 'model' is a dictionary loaded from the pickle file. 'loadpickle' and ...
4
votes
1answer
591 views

Safe handling of variables in multi-threading application with shared resources

I've been developing this application as my first C++ project and am at a point where it is functional and would like to take a step back and critique/improve my code from a standpoint of ...
1
vote
0answers
88 views

Sensor-Stream-Recorder Project

I'm a student working on a project to record sensor data from magnetic sensors. As part of the project, I created a 'Recorder-Tool' using opencv to acquire the recordings I need. The purpose of this ...