Questions tagged [opencv]
OpenCV (Open Source Computer Vision) is a cross-platform library of programming functions for real time computer vision.
132
questions
24
votes
2
answers
56k
views
Crop black border of image using NumPy
Objective: Crop the image so only the number stays in the image
Problem: Slow Performance
I have code that crops an image.
The image pixels are 0 or 255. There are no values between.
The ...
20
votes
4
answers
16k
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:
...
17
votes
1
answer
478
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 ...
16
votes
1
answer
7k
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 ...
14
votes
1
answer
3k
views
Dynamic Colour Binning: Grouping Similar Colours in Images
This is a piece of code that implements an image-processing algorithm I came up with. I call it Dynamic Colour Binning. It's a fairly academic exercise that was more about providing a learning ...
13
votes
3
answers
1k
views
Looking for the particles that are emitted when a fish is detected in Terraria
The code run perfectly fine, with no errors. However, the entirety of the code is in 1 function and is kind of hard to read. As well as that I'm not sure if and how the code could be more optimised/...
12
votes
3
answers
8k
views
Density-based clustering of image keypoints
I have implemented the DBSCAN algorithm for clustering image keypoints. I have been following the pseudocode on the wiki page pretty strictly, and it's working, but I get the feeling its a very naive ...
12
votes
1
answer
1k
views
Custom iterator implementation returning OpenCV Mat
I have written an adapter class that allows iteration over the rows of a Mat object from OpenCV. For those interested, here is the Mat documentation, but the ...
10
votes
1
answer
18k
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 ...
10
votes
2
answers
1k
views
OpenCV Mat processing time
I'd like to know whether having different variables for the src (source) and dst (destination) of an OpenCV function will have an effect on the processing time. I have two functions below
that does ...
10
votes
1
answer
12k
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 ...
10
votes
1
answer
2k
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 ...
9
votes
2
answers
2k
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 ...
8
votes
2
answers
1k
views
Face tracking with recognition and age/gender detection
This program loads a video, detects and tracks faces in the video and detects the estimated age and gender of each person. The objective is to collect data on the number of unique people in a video ...
8
votes
1
answer
208
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
1
answer
12k
views
"Histogram of Oriented Gradients" (HOG) feature detector for computer vision
Here is a function that I've only slightly modified from its original context, found here.
Before mentioning anything else, it should be noted that I'm desperately trying to optimize this code for ...
7
votes
1
answer
797
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 ...
6
votes
1
answer
3k
views
Program for face recognition
I have been using the following script for face recognition as a security feature:
main.py
...
6
votes
2
answers
1k
views
Image edge detection
I have a Canny Edge Detection Code written in C++. I would like to know how can I make it more robust in terms of detecting all the edges correctly and save it? Is this the best possible edge ...
6
votes
1
answer
684
views
Tracking Eye Movements
The following class (that was my first class ever in python) was used in an eye tracking context. Imagine a context where you always will have a single gaze-point and some closed contours. How can I ...
6
votes
1
answer
3k
views
Replace subimage by its average value
I have the input image in, and the mask image lev (which label each pixel as a number from 1 to ...
6
votes
1
answer
166
views
Image stitching using SIFT keypoint descriptor and homography matrix
I have written a code to stitch 2 images using SIFT keypoint descriptor and homography matrix for perspective transform. Are there any areas where code an be improved or optimized?
...
6
votes
1
answer
145
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 ...
6
votes
1
answer
267
views
Dealing with lot of images and multiplications
With some basic knowledge of Python and referring a lot of sources, I have written the code below. But it takes half an hour for execution. How can I reduce the time? I read about vectorization but ...
6
votes
1
answer
4k
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.
...
6
votes
1
answer
2k
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 ...
6
votes
1
answer
10k
views
Histogram of a RGB image using OpenCV
I wrote some C++ code using the OpenCV library. The program reads the image and plot histograms of Red, Green, and Blue components. I am very new to OpenCV so I need comments and advice. What do you ...
6
votes
1
answer
1k
views
Python 3 script to make photo collages
I have written a Python script that takes a list of filenames of pictures and generates a photo collage of them. This is my most complex project yet, and I have written it completely by myself (like I ...
6
votes
1
answer
5k
views
Python GUI for cropping and saving images quickly
I wrote a simple GUI applications to help me select 'positive' regions of a bunch of photos for the purpose of training an object detectir using OpenCV Haar Cascades.
For training purposes, you need ...
6
votes
0
answers
432
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 ...
5
votes
1
answer
968
views
Remove background from a directory of JPEG images
I wrote a code to remove the background of 8000 images but that whole code is taking approximately 8 hours to give the result.
How to improve its time complexity? As I have to work on a larger dataset ...
5
votes
1
answer
158
views
Display image from live webcam as taken, with four different color filters and in B/W
I have a live webcam windows which means there are six subdivided windows in a single window live. And show pictures in colored and black and white. Is there anyway I can make the code ...
5
votes
2
answers
2k
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 ...
5
votes
1
answer
422
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 ...
5
votes
2
answers
2k
views
More optimized approach of Dijkstra's algorithm
I need a graph-search algorithm that is enough in our application of robot navigation and I chose Dijkstra's algorithm.
We are given the gridmap which contains free, occupied and unknown cells where ...
5
votes
2
answers
581
views
Analyzing the darkest pixels of an image in Python
This script takes an image copied from the clipboard and analyzes the n darkest pixels of the image. It will loop through each found value, prints out the value information and the quantity, then ...
5
votes
1
answer
3k
views
Connected component analysis
I finished a program to do connected component analysis using union - find algorithm. Is it true that the complexity of the code is \$O(N logN)\$, where \$N\$ is the total number of pixels (512x512 by ...
5
votes
1
answer
58
views
Rainbow Trails Video Effect
This is an effect to augment juggling videos:
The goal of this effect is to add a rainbow trail to a video using a tracked set of points.
Link to source video
Link to source data
Link to complete ...
5
votes
1
answer
143
views
Image tracking code using opencv in python
I wrote this code to track small moving objects falling down a chute. The code works buts runs too slowly: using 60 FPS 1920 by 1080 footage the code only runs at about 10 FPS. The problem there is ...
5
votes
1
answer
8k
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 ...
5
votes
0
answers
633
views
Selecting child contours in OpenCV
I'm really new to OpenCV. :) I have been working on this for almost an entire day. After hours of sleepless work I would like to know if I can further improve my code.
I have written some code to ...
5
votes
0
answers
78
views
Interfaces and OOP Design for Image Editor software
I'm new to C++ programming, and I'm building an Image Editor software like Lightroom/CameraRaw from scratch.
Apart from procedural code (actually seems that all the functions works correctly) my goal ...
5
votes
0
answers
39k
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 ...
4
votes
3
answers
8k
views
Create a two-dimensional Gaussian kernel
In my code I have a function that generate a 2D gaussian function given sigma like so:
...
4
votes
1
answer
949
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 ...
4
votes
2
answers
1k
views
Captcha Letter Extraction
We are developing an automatic text Captcha solver in python 3. The solver has a module that is responsible for extracting letters out of captcha images that contain 4 letters each. We would like to ...
4
votes
1
answer
351
views
Loops through each row in a binary image and gets the width of each group of black or white pixels
Example image:
Code:
...
4
votes
1
answer
1k
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 ...
4
votes
1
answer
3k
views
OpenCV 3: Using k-Nearest Neighbors to analyse RGB image
I'm new to computer vision and numpy.
I wrote a simple script to seperate red, green and blue colors from the original image by using the kNN algorithm.
After reading through some numpy tutorials, I'...
4
votes
1
answer
2k
views
Shortest path in image
This code takes an image and detects a global shortest path from the top to bottom row, with the requirement that top and bottom column index be the same. For this, it scans through each element on ...