image-processing

Identifying state of tic-tac-toe board from image

柔情痞子 提交于 2021-02-07 10:13:38
问题 I'm working on a project where I have to use openCV in java to identify the state of a tic tac toe board. Please see the sample program execution below. input Output X,-,- -,O,- X,-,- I'm trying to solve this by finding contours in the image, but the problem is that the empty unmarked boxes are also being captured and I'm not being able to distinguish between the shapes using contour properties like polygon size and contour area. Below is the code that I have so far. package finalproject;

Identifying state of tic-tac-toe board from image

痞子三分冷 提交于 2021-02-07 10:13:34
问题 I'm working on a project where I have to use openCV in java to identify the state of a tic tac toe board. Please see the sample program execution below. input Output X,-,- -,O,- X,-,- I'm trying to solve this by finding contours in the image, but the problem is that the empty unmarked boxes are also being captured and I'm not being able to distinguish between the shapes using contour properties like polygon size and contour area. Below is the code that I have so far. package finalproject;

Remove text from jpeg

╄→гoц情女王★ 提交于 2021-02-07 10:13:18
问题 I have a jpeg containing alpha blended text. Knowing the font and size, I deduced a png file representing the text Using ImageMagick, can I get an approximation of the original picture? 回答1: Albert Myšák has the proper technique here, since one knows the exact alpha channel values for the text and the equation that describes how the alpha channel is blended with the image. Kudos! My earlier methods are better suited to when one only knows the positions of the text pixels in the image, so that

Patch priority and its effect on Criminsi's Exemplar Based Inpainting

允我心安 提交于 2021-02-07 09:37:29
问题 I am trying to implement exemplar based in-painting, as proposed by Criminsi et. al. in its original format (before moving into further optimisations). I have a few theoretical doubts which I would like to clarify. I am not sure how the patch priority and the determination of fill-order works to propagate linear structures into the user-selected target region. From what I understand, Criminsi suggests the following: Determine the fill front dΩ. Compute the patch priorities [C(p)D(p)] on

OpenCV - Save video segments based on certion condition

时光总嘲笑我的痴心妄想 提交于 2021-02-07 09:26:30
问题 Aim : Detect the motion and save only the motion periods in files with names of the starting time . Now I met the issue about how to save the video to the files with video starting time. What I tested : I tested my program part by part. It seems that each part works well except the saving part. Running status : No error. But in the saving folder, there is no video. If I use a static saving path instead, the video will be saved successfully, but the video will be override by the next video. My

Calculating FFT Correlation Coefficient

北城余情 提交于 2021-02-07 07:55:10
问题 I would like to calculate the correlation coefficient of 2 sound samples using AForge 2.2.5 . I've read from here the formula to calculate Cross Correlation. And here I've read about the formula to calculate the correlation coefficient. This is currently what I have: Prior to calling CrossCorrelation(), FFT has been performed. static Complex[] CrossCorrelation(Complex[] ffta, Complex[] fftb) { var conj = ffta.Select(i => new Complex(i.Re, -i.Im)).ToArray(); for (int a = 0; a < conj.Length; a+

Calculating FFT Correlation Coefficient

拜拜、爱过 提交于 2021-02-07 07:54:08
问题 I would like to calculate the correlation coefficient of 2 sound samples using AForge 2.2.5 . I've read from here the formula to calculate Cross Correlation. And here I've read about the formula to calculate the correlation coefficient. This is currently what I have: Prior to calling CrossCorrelation(), FFT has been performed. static Complex[] CrossCorrelation(Complex[] ffta, Complex[] fftb) { var conj = ffta.Select(i => new Complex(i.Re, -i.Im)).ToArray(); for (int a = 0; a < conj.Length; a+

Split image tensor into small patches

谁说胖子不能爱 提交于 2021-02-07 07:12:26
问题 I have an image of shape (466,394,1) which I want to split into 7x7 patches. image = tf.placeholder(dtype=tf.float32, shape=[1, 466, 394, 1]) Using image_patches = tf.extract_image_patches(image, [1, 7, 7, 1], [1, 7, 7, 1], [1, 1, 1, 1], 'VALID') # shape (1, 66, 56, 49) image_patches_reshaped = tf.reshape(image_patches, [-1, 7, 7, 1]) # shape (3696, 7, 7, 1) unfortunately does not work in practice as image_patches_reshaped mixes up the pixel order (if you view images_patches_reshaped you will

Split image tensor into small patches

若如初见. 提交于 2021-02-07 07:11:53
问题 I have an image of shape (466,394,1) which I want to split into 7x7 patches. image = tf.placeholder(dtype=tf.float32, shape=[1, 466, 394, 1]) Using image_patches = tf.extract_image_patches(image, [1, 7, 7, 1], [1, 7, 7, 1], [1, 1, 1, 1], 'VALID') # shape (1, 66, 56, 49) image_patches_reshaped = tf.reshape(image_patches, [-1, 7, 7, 1]) # shape (3696, 7, 7, 1) unfortunately does not work in practice as image_patches_reshaped mixes up the pixel order (if you view images_patches_reshaped you will

How to get all pixel coordinates in an area specified in an image in python?

六眼飞鱼酱① 提交于 2021-02-07 04:14:40
问题 The area in image is defined by 4 coordinates x1,y1,x2,y2,x3,y3,x4,y4 and I want to retrieve all the pixel coordinates x,y inside that area. 回答1: Assuming a rectangular shape, you can use np.mgrid to generate a coordinate matrix for the points between your top left and bottom right corners. X, Y = np.mgrid[xmin:xmax, ymin:ymax] and convert them to a bidimensional array of coordinates with np.vstack((X.ravel(), Y.ravel())) EDIT: arbitrary shapes As Mark Setchell pointed out, there is nothing