Questions tagged [opencv]

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

Filter by
Sorted by
Tagged with
21
votes
2answers
45k 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 ...
18
votes
4answers
14k 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
1answer
395 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
1answer
6k 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
1answer
2k 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 ...
12
votes
3answers
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
1answer
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
1answer
16k 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
2answers
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
1answer
6k 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
1answer
1k 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
2answers
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
1answer
196 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
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
1answer
725 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
1answer
3k views

Program for face recognition

I have been using the following script for face recognition as a security feature: main.py ...
6
votes
2answers
409 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
1answer
662 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
1answer
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
1answer
138 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
1answer
254 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
1answer
2k 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
1answer
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
1answer
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
1answer
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 ...
6
votes
0answers
348 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
1answer
116 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
2answers
1k 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
1answer
401 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
2answers
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
2answers
58 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
1answer
2k 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
1answer
76 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
1answer
4k 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 ...
5
votes
0answers
106 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
0answers
46 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
0answers
36k 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
3answers
6k 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
1answer
708 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
2answers
621 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
1answer
202 views
4
votes
1answer
913 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
1answer
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 ...
4
votes
1answer
653 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 some ...
4
votes
0answers
63 views

Merging two, three or four images

This code is about merging two or more images. Minimum images are two while maximum images loaded are four. So I will check how many images the user wants to merge. If the user chooses 2 and selects ...
4
votes
0answers
76 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 ...
4
votes
0answers
3k 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, ...
4
votes
0answers
419 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 ...
3
votes
2answers
1k views

Merging rectangles in C++ [closed]

I have the following code for separating out overlapping rectangles vs. non-overlapping rectangles in C++ 11: ...
3
votes
2answers
216 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 ...