image-processing

Decompose Homography matrix in opencv python

风流意气都作罢 提交于 2020-03-21 06:01:36
问题 H = K[R|t] where H (3*3) is homographic matrix, R is Rotation matrix, K is matrix of camera's intrinsic parameters and t is translation vector. I have calculated K using chess board pattern as follows ret, K, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, chess_gray.shape[::-1],None,None) Homograpy matrix H is calculated as pts_src = np.float32(pts_src) pts_dst = np.float32(pts_dst) H, status = cv2.findHomography(pts_src, pts_dst) How to decompose R and t from H and K using

How to detect separate figures in an image?

一世执手 提交于 2020-03-20 05:23:19
问题 I have an image similar to the following. I want to separate two numbers 7 and 4 as shown in the image, in that I want to have a bounding box for each of these two objects. How could I do this with OpenCV? I have no idea, how could I do this and was thinking if there is some way by using Sobel operator. The only thing that I tired was getting the Sobel. s = cv2.Sobel(img, cv2.CV_64F,1,0,ksize=5) but have no idea on how to proceed from here. 回答1: To segment and detect figures in an image, the

How to detect separate figures in an image?

半城伤御伤魂 提交于 2020-03-20 05:20:23
问题 I have an image similar to the following. I want to separate two numbers 7 and 4 as shown in the image, in that I want to have a bounding box for each of these two objects. How could I do this with OpenCV? I have no idea, how could I do this and was thinking if there is some way by using Sobel operator. The only thing that I tired was getting the Sobel. s = cv2.Sobel(img, cv2.CV_64F,1,0,ksize=5) but have no idea on how to proceed from here. 回答1: To segment and detect figures in an image, the

Number of haar like features in 24x24 window

≯℡__Kan透↙ 提交于 2020-03-20 04:54:35
问题 Referring to the following link Viola & Jones Face Detection The above link contains the calculation regarding the number of haar features corresponding to different templates(below is excerpt from the link). I am not getting how those(43200,27600,43200,27600,20736) exact calculations are made.Can somebody explain that to me in an easy way? 回答1: To understand, have a look at the algorithm #1. For the first pattern (a) , the following two lines (5 and 6 in the article) gives the explanations

Number of haar like features in 24x24 window

心已入冬 提交于 2020-03-20 04:54:04
问题 Referring to the following link Viola & Jones Face Detection The above link contains the calculation regarding the number of haar features corresponding to different templates(below is excerpt from the link). I am not getting how those(43200,27600,43200,27600,20736) exact calculations are made.Can somebody explain that to me in an easy way? 回答1: To understand, have a look at the algorithm #1. For the first pattern (a) , the following two lines (5 and 6 in the article) gives the explanations

Number of haar like features in 24x24 window

和自甴很熟 提交于 2020-03-20 04:49:36
问题 Referring to the following link Viola & Jones Face Detection The above link contains the calculation regarding the number of haar features corresponding to different templates(below is excerpt from the link). I am not getting how those(43200,27600,43200,27600,20736) exact calculations are made.Can somebody explain that to me in an easy way? 回答1: To understand, have a look at the algorithm #1. For the first pattern (a) , the following two lines (5 and 6 in the article) gives the explanations

Remove background text and noise from an image using image processing with OpenCV

六月ゝ 毕业季﹏ 提交于 2020-03-19 07:43:09
问题 I have these images For which I want to remove the text in the background. Only the captcha characters should remain(i.e K6PwKA, YabVzu). The task is to identify these characters later using tesseract. This is what I have tried, but it isn't giving much good accuracy. import cv2 import pytesseract pytesseract.pytesseract.tesseract_cmd = r"C:\Users\HPO2KOR\AppData\Local\Tesseract-OCR\tesseract.exe" img = cv2.imread("untitled.png") gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) gray

Find question text block in image with Python Opencv

柔情痞子 提交于 2020-03-19 05:40:50
问题 How can I select question blocks in a jpg file with questions in Python code? The codes below select texts. I want to select question blocks with their choices. import cv2 image = cv2.imread('test2.jpg') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blur = cv2.GaussianBlur(gray, (9,9), 0) thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9)) dilate = cv2.dilate(thresh, kernel, iterations

VideoWriter outputs corrupted video file

社会主义新天地 提交于 2020-03-18 12:23:01
问题 This is my code to save web_cam streaming. It is working but the problem with output video file. import numpy as np import cv2 cap = cv2.VideoCapture(0) # Define the codec and create VideoWriter object #fourcc = cv2.cv.CV_FOURCC(*'DIVX') #out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) out = cv2.VideoWriter('output.avi', -1, 20.0, (640,480)) while(cap.isOpened()): ret, frame = cap.read() if ret==True: frame = cv2.flip(frame,0) # write the flipped frame out.write(frame) cv2.imshow(

ImageMagick is splitting the NASA's [.IMG] file by a black line upon converting to JPG

淺唱寂寞╮ 提交于 2020-03-18 10:15:34
问题 I have some raw .IMG format files which I'm converting to .jpg using ImageMagick to apply a CNN Classifier. The converted images, however have a black vertical line splitting the image into two. The part on the left side of the line should have actually been on the right side of the right part of the image. I've posted a sample image: I used the command magick convert input_filename.IMG output_filename.jpg Raw .IMG File Here is how the image is supposed to look (converted manually using numpy