OpenCV

Drawing contours from label_image

孤街浪徒 提交于 2021-01-28 09:40:45
问题 I have a label_image array and I am deriving the outlines/boundaries of the objects on that array. Currently I am doing that by getting all unique labels, iterating over them and then find the contours of each object. Like in the loop below, where I am populating a dict with keys the label and values the contours import cv2 import pandas as pd import numpy as np def extract_borders(label_image): labels = np.unique(label_image[label_image > 0]) d = {} for label in labels: y = label_image ==

java opencv png image with alpha channel over video issue

此生再无相见时 提交于 2021-01-28 09:29:25
问题 everybody. I'm trying to place ".png" image over the video capture using java and opencv. I performed the tutorial from the official opencv java website http://opencv-java-tutorials.readthedocs.io/en/latest/04-opencv-basics.html In this tutorial everything works fine with png image from the tutorial. But when i try to load my own png image with alpha channel, i get the wrong result. Png image displays with white spaces. Here is the print screens of video capture with both images: correct

java opencv png image with alpha channel over video issue

风格不统一 提交于 2021-01-28 09:23:03
问题 everybody. I'm trying to place ".png" image over the video capture using java and opencv. I performed the tutorial from the official opencv java website http://opencv-java-tutorials.readthedocs.io/en/latest/04-opencv-basics.html In this tutorial everything works fine with png image from the tutorial. But when i try to load my own png image with alpha channel, i get the wrong result. Png image displays with white spaces. Here is the print screens of video capture with both images: correct

Error on loading OpenCV EAST text detector in Python

断了今生、忘了曾经 提交于 2021-01-28 09:20:22
问题 I'm trying to use EAST text detector to detect areas of text in images, but am having trouble on loading the pre-trained EAST text detector. The following is my text_detection.py file from imutils.object_detection import non_max_suppression import numpy as np import argparse import time import cv2 import requests import urllib # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", type=str,help="path to input image") ap.add

Extract text with strikethrough from image

风流意气都作罢 提交于 2021-01-28 09:03:46
问题 Here's an example image -> I would like to extract text that has text-decoration/styling of strikethrough. So for the above image I would like to extract - de location How would I do this ? Here's what I have so far using OpenCV and python : import cv2 import numpy as np import matplotlib.pyplot as plt im = cv2.imread(<image>) kernel = np.ones((1,44), np.uint8) morphed = cv2.morphologyEx(im, cv2.MORPH_CLOSE, kernel) plt.imshow(morphed) This gives me the horizontal lines -> I am new to image

Open CV Code - Can someone help me understand what the code is doing

梦想的初衷 提交于 2021-01-28 08:31:11
问题 I am working on the OpenCV color blob and I am reviewing the code. I need some help understand what the code is doing so that I can work further on it and help integrate this further. Is it possible for someone to help me with understanding/commenting the code so it is easier to interpate. public boolean onTouch(View v, MotionEvent event) { int cols = mRgba.cols(); //get resolution of display int rows = mRgba.rows(); // get resolution of display int xOffset = (mOpenCvCameraView.getWidth() -

histogram equalization using python and opencv without using inbuilt functions

寵の児 提交于 2021-01-28 08:28:17
问题 I have used formula: ((L-1)/MN) ni where L is total no of graylevels,M N is size of image, ni is cumulative frequency But I am getting full black image always.I have tried with other images as well. import numpy as np import cv2 path="C:/Users/Arun Nambiar/Downloads/fingerprint256by256 (1).pgm" img=cv2.imread(path,0) #To display image before equalization cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows() a=np.zeros((256,),dtype=np.float16) b=np.zeros((256,),dtype=np.float16)

Depth reconstruction from disparity map using stereo camera

怎甘沉沦 提交于 2021-01-28 08:24:31
问题 I'm working on depth reconstruction from disparity map. I use OpenCV to calibrate my stereo camera, then undistort and rectify the images. I use LibELAS to compute the disparity map. My question is: According to OpenCV document (https://docs.opencv.org/3.1.0/dd/d53/tutorial_py_depthmap.html), the depth is computed by depth = Baseline*focal_length/disparity . But according to middlebury dataset (http://vision.middlebury.edu/stereo/data/scenes2014/), the depth is computed by depth = baseline *

Import error “undefined symbol: _ZNK9FastNoise8GetNoiseEff” when calling C++ extension in Python 3.6

寵の児 提交于 2021-01-28 08:01:15
问题 I am currently trying to make some C++ extensions for a python script. In the C++ side of the story, it seems to be compiled just fine and it generates my .so shared library, but when I call it inside my python script it raises an error of undefined symbol. The current code is as follow: #include <iostream> #include "FastNoise.h" #include <string> #include <time.h> #include <opencv2/core.hpp> #include <opencv2/imgcodecs.hpp> #include <opencv2/highgui.hpp> #include <boost/python/def.hpp>

Can the OpenCv circle function be used to draw a circle with an odd diameter?

倖福魔咒の 提交于 2021-01-28 07:10:08
问题 I would like to draw a circle with a diameter of 15 into a matrix of 15 by 15. For this I tried the OpenCv circle function and the shift function. I am not sure whether I use the function in a correct way or wheather it is not possible what I would like to do. The best I achieve is the following unsymmetric circle with a size of 16 pixels: How can I get a symmetric circle with a diameter of 15 pixels? The code I used: import cv2 import numpy as np circle_diameter = 15 circular_mask = np.zeros