cv2

Open CV -unable to execute python code having cv2

别来无恙 提交于 2019-12-11 17:49:59
问题 I'm using CL-SOM-AM57x - TI AM5728 / AM5718 System-on-Module and load it with Ti's matrix app launcher based on Linux Debian. I am trying to develop a python app which can be launched from TI Matrix GUI. With simple python code the app works fine in Terminal(loads and import openCV and numpy) but when I launch and run the App(have created Icon and the app is executing) from TI matrix GUI which doesn't work properly and shows some errors/warnings in terminal. The App is opening and Prints on

Can I use cv2.cvtColor(image,cv2.COLOR_GRAY2RGB) on a batch of data?

霸气de小男生 提交于 2019-12-11 17:18:56
问题 I am working with Inception v3, trying to use MNIST JPG images as the dataset to predict. I am running into a problem when its time to input training batches into the model. The error is because of the shape. X_batch produces a shape of (?,299,299), where as the first layer needs a shape of (?, 299, 299, 3). In a different part of my code that displaces a few examples I was able to use example_image = cv2.cvtColor(example_image,cv2.COLOR_GRAY2RGB) to convert the examples into RGB which gave

cv2, keras, InternalError (see above for traceback): Blas GEMM launch failed

本小妞迷上赌 提交于 2019-12-11 08:04:14
问题 I get this Error: InternalError (see above for traceback): Blas GEMM launch failed : a.shape=(1, 2304), b.shape=(2304, 512), m=1, n=512, k=2304 [[Node: dense_1/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](flatten_1/Reshape, dense_1/kernel/read)]] This is my code. I try to load a keras model. and predict the class of an image. But it always crashes when I want to predict the class of the image. from __future__ import print

Python CV2 Color Space Conversion Fidelity Loss

对着背影说爱祢 提交于 2019-12-11 07:19:54
问题 Observe the following image: Observe the following Python code: import cv2 img = cv2.imread("rainbow.png", cv2.IMREAD_COLOR) img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # convert it to hsv img = cv2.cvtColor(img, cv2.COLOR_HSV2BGR) # convert back to BGR cv2.imwrite("out.png", img) Here's the output image: If you can't see it, there's a clear loss of visual fidelity in the image here. For comparison's sake, here's the original next to the output image zoomed in around the yellows: What's going

dlib/cv2 Working with hundred thousand of pictures

天大地大妈咪最大 提交于 2019-12-11 07:05:38
问题 For my next university-project i will have to teach a Convoluted Neural Network how to denoise a picture of a face so i started digging the we for datasets of faces. I stumbled upon this dataset (CelebA) with 200k+ pictures of people and i found the first few problems: there are too many pictures to do basic computation on them. I should: Open each image and make a numpy array out of it (dlib.load_rgb_image is fine) Find a face it, use the 5 point shape predictor to find the eyes and align

Convert all white pixels in the image into black pixels

我们两清 提交于 2019-12-10 19:11:23
问题 I have this image rand-walk-2.png I would like to convert all the white pixels to black pixels, so that there is a picture of a red random walk over a black background, this means I cannot just invert the colors of image. My current code simply finds the white pixels and set them to black: from PIL import Image import PIL.ImageOps import numpy as np from skimage.io import imsave import cv2 in_path = 'rand-walk-2.png' out_path = 'rand-walk-trial.png' Image = cv2.imread(in_path) Image2 = np

Remove remains in a letter image with Python

﹥>﹥吖頭↗ 提交于 2019-12-10 17:51:42
问题 I have a set of images that represent letters extracted from an image of a word. In some images there are remains of the adjacent letters and I want to eliminate them but I do not know how. Some samples I'm working with openCV and I've tried two ways and none works. With findContours: def is_contour_bad(c): return len(c) < 50 gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) edged = cv2.Canny(gray, 50, 100) contours = cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

OpenCV 4.0.0 SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set

孤人 提交于 2019-12-10 17:18:29
问题 Hello I am trying to create a facial recognition program but I have a peculiar error: here is my code: gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face_cascade = cv2.CascadeClassifier("lbpcascade_frontalface.xml") faces = face_cascade.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=5); and this error is the output SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set I have "lbpcascade_frontalface.xml" in the working directory so that shouldn't be an issue if

Unable to import cv2 module (Python 3.6)

為{幸葍}努か 提交于 2019-12-10 09:11:47
问题 total nexwbie here. I'm unsuccessfully trying to install the cv2 module for python but it doesn't work. I'm working with Python 3.6 (64bits) I typed the following commands in the cmd : C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3 install cv2 Collecting cv2 Could not find a version that satisfies the requirement cv2 (from versions: ) No matching distribution found for cv2 C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3

Images opened in Pillow and OpenCV are not equivelant

大憨熊 提交于 2019-12-09 13:26:14
问题 I downloaded a test image from Wikipedia (the tree seen below) to compare Pillow and OpenCV (using cv2 ) in python. Perceptually the two images appear the same, but their respective md5 hashes don't match; and if I subtract the two images the result is not even close to solid black (the image shown below the original). The original image is a JPEG. If I convert it to a PNG first, the hashes match. The last image shows the frequency distribution of how the pixel value differences. As Catree