OpenCV

store captured image in MySQL database with Python and OpenCV

半腔热情 提交于 2021-02-08 11:10:51
问题 I have a piece of code here which captures an image from my internal webcam on my laptop. With this image, i would like to directly send it to my MySQL database. here is the code. import numpy as np import cv2 import mysql.connector from mysql.connector import errorcode from time import sleep import serial # Obtain connection string information from the portal config = { 'host':'oursystem.mysql.database.azure.com', 'user':'user', 'password':'pass', 'database':'projectdb' } try: conn = mysql

OpenCV resolvePnP without camera and distortion matrices

回眸只為那壹抹淺笑 提交于 2021-02-08 10:55:39
问题 I am trying to make a AR app for android in witch the user points the camera to a square marker and a 3d model should show on top of the marker. I am using OpenCV to get the rotation and translation of the marker but.. To get these 2 matrices, I use solvePnP for which I have to provide a camera matrix and a distortion matrix which (from my understanding) are specific for each camera type. Unfortunately, this is a huge drawback for me since the app should be supported by most Android devices

Access pixels in gpu::mat

南楼画角 提交于 2021-02-08 10:50:53
问题 I'd like to know how to access pixel information when using OpenCV GPU. I'm currently downloading gpu::mat information to a mat variable but it is too slow. Does anyone know how to do it? 回答1: You could access to the data inside a kernel. For (row,col) the row and column number, the value of a pixel with channel number ch < 3 will be: uint8_t val = gpumat.data[ (row*gpumat.step) + col*gpumat.channels() + ch]; So let say you have an BGR input image stored on a GpuMat called src and you want to

Display a image from the Webcam using openCV and openGL

怎甘沉沦 提交于 2021-02-08 10:46:28
问题 I'm capturing a picture from a webcam with openCV. Then the frame should be transformed into an openGL texture and be shown on the screen. I got the following code but the window remains black. I'm very new to openGL and have no more ideas why it doesn't work. int main () { int w = 800,h=600; glfwInit(); //configure glfw glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint

OpenCV aruco, Z-axis doesn't draw properly

▼魔方 西西 提交于 2021-02-08 10:44:50
问题 I have a problem with function drawAxis in aruco module. Z axis flip and general aren't at 90 degrees (X and Y works fine). The problem is illustrated by the screen: flip axis I tried changed camera, detect another markers and do many recalibration (i tried different configuration of photos, between 15 and 100) When I printed vector of rotation (rvec) I noticed that angle 0 and 1 (x, y?) had small fluctuation, but angle 2 (z?) are in general constant: rvec print Where could be a problem? If X

extract bits from 32 bit float numbers in C

筅森魡賤 提交于 2021-02-08 10:36:30
问题 32 bits are represented in binary using the IEEE format. So how can I extract those bits? Bitwise operations like & and | do not work on them! what i basically want to do is extract the LSB from 32 bit float images in opencv thanx in advance! 回答1: uint32_t get_float_bits(float f) { assert(sizeof(float) == sizeof(uint32_t)); // or static assert uint32_t bits; memcpy(&bits, &f, sizeof f); return bits; } As of C99, the standard guarantees that the union trick works (provided the sizes match),

Build java application that uses opencv portable

浪尽此生 提交于 2021-02-08 10:23:17
问题 I want to create executable .jar file that opencv is embedded in the package. I mean that I can run it on another computer. Please, someone helps me??? I have this code in file SimpleSample.java : import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.CvType; import org.opencv.core.Scalar; class SimpleSample { static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } public static void main(String[] args) { System.out.println("Welcome to OpenCV " + Core.VERSION); Mat m

How display multi videos with threading using tkinter in python?

半世苍凉 提交于 2021-02-08 10:13:04
问题 I recently created a program which displays multi video sources from 2 ip cameras with opencv. but I decided to create UI for my application, and now, It's not so clear for me that how I can implement it using multi threading method. here is the code I used to display only one camera in TKinter GUI: import tkinter import cv2 import PIL.Image, PIL.ImageTk import time class App: def __init__(self, window, window_title, video_source=0): self.window = window self.window.title(window_title) self

we are doing pan OCR, using tesseract but is not able to detect the details like name and pan number

五迷三道 提交于 2021-02-08 10:12:55
问题 We are cropping the pan card image by increasing the height by 20px for every iteration and then we are passing that image to tesseract to do ocr but we are getting noise with output.if you have better solution on Image processing or another libraries like cv2 then please help us. import pytesseract from PIL import Image, ImageEnhance, ImageFilter im = Image.open("image/testpan.jpg") width = im.size[0] height = im.size[1] print('width,height-->',width,height) yy='img' zz='.jpg' x=0 for j in

Use OpenCV on deployed Flask app (Heroku)

青春壹個敷衍的年華 提交于 2021-02-08 10:12:54
问题 Hello I seem to be having trouble importing opencv on my deployed flask app on Heroku! I've referred to similar posts such as this this "ImportError: libSM.so.6: cannot open shared object file: No such file or directory " but can't seem to figure out the next steps on windows. This is what I've done so far: 1. gone to Heroku -> App -> Settings -> Buildpacks -> added Python buildpack 2. Added a Aptfile.txt to my directory with the following packages on each line (read this somewhere not sure