image-processing

Python blurred image creation, to create a beautifully colored painting from black to white

扶醉桌前 提交于 2021-02-19 07:43:44
问题 on Pyhton I wanted to create a picture that goes from black to white, and I wrote the following code. But I think I'm doing a very small mistake, and that's the result. I actually wanted to create a similar image. Can you see where I made a mistake? import numpy as np from PIL import Image width = 100 height = 100 img = np.zeros((height, width), dtype=np.uint8) xx, yy=np.mgrid[:height, :width] circle = (xx - 50)**2 + (yy- 50)**2 for x in range (img.shape[0]): for y in range (img.shape[1]):

Occlusion with camshift

自作多情 提交于 2021-02-19 07:26:50
问题 I am working on object tracking by camshift algorithm. For the time being I am using the inbuilt opencv code wherein I have trouble dealing with occlusion. hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, np.array((0., 60., 32.)), np.array((180., 255., 255.))) prob = cv2.calcBackProject([hsv], [0], self.hist, [0, 180], 1) cv2.imshow('prob_0',prob) prob &= mask cv2.imshow('prob',prob) term_crit = ( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1 ) track_box,

Occlusion with camshift

馋奶兔 提交于 2021-02-19 07:24:30
问题 I am working on object tracking by camshift algorithm. For the time being I am using the inbuilt opencv code wherein I have trouble dealing with occlusion. hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, np.array((0., 60., 32.)), np.array((180., 255., 255.))) prob = cv2.calcBackProject([hsv], [0], self.hist, [0, 180], 1) cv2.imshow('prob_0',prob) prob &= mask cv2.imshow('prob',prob) term_crit = ( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1 ) track_box,

read and display raw image using python

只愿长相守 提交于 2021-02-19 04:22:46
问题 I want to try view the image using spyder python as in: skydrive share the image is: uint16 (10-bit) width:1376 pixel, height: 960 pixel no header bayer pattern blue-green, green-red What python script is suitable? Thanks. 回答1: Here is one way. Start with imports from matplotlib import pyplot as plt import numpy as np Now allocate the space image = np.empty((1376,960), np.uint16) Read the image into your array: image.data[:] = open('20_1-20ms.raw').read() Display it: plt.imshow(image) 来源:

read and display raw image using python

风流意气都作罢 提交于 2021-02-19 04:22:00
问题 I want to try view the image using spyder python as in: skydrive share the image is: uint16 (10-bit) width:1376 pixel, height: 960 pixel no header bayer pattern blue-green, green-red What python script is suitable? Thanks. 回答1: Here is one way. Start with imports from matplotlib import pyplot as plt import numpy as np Now allocate the space image = np.empty((1376,960), np.uint16) Read the image into your array: image.data[:] = open('20_1-20ms.raw').read() Display it: plt.imshow(image) 来源:

How to mask image with binary mask

与世无争的帅哥 提交于 2021-02-19 02:40:21
问题 Suppose I have a greyscale image here: And a binary masked image here: With the same dimensions and shape. How do I generate something like this: Where the values indicated by the 1 in the binary mask are the real values, and values that are 0 in the mask are null in the final image. 回答1: Use cv2.bitwise_and to mask an image with a binary mask. Any white pixels on the mask (values with 1) will be kept while black pixels (value with 0) will be ignored. Here's a example: Input image (left),

OpenCV: Fundamental matrix accuracy

主宰稳场 提交于 2021-02-18 19:21:29
问题 I am trying to calculate the fundamental matrix of 2 images (different photos of a static scene taken by a same camera). I calculated it using findFundamentalMat and I used the result to calculate other matrices (Essential, Rotation, ...). The results were obviously wrong. So, I tried to be sure of the accuracy of the calculated fundamental matrix. Using the epipolar constraint equation , I Computed fundamental matrix error. The error is very high (like a few hundreds). I do not know what is

OpenCV: Fundamental matrix accuracy

若如初见. 提交于 2021-02-18 19:21:28
问题 I am trying to calculate the fundamental matrix of 2 images (different photos of a static scene taken by a same camera). I calculated it using findFundamentalMat and I used the result to calculate other matrices (Essential, Rotation, ...). The results were obviously wrong. So, I tried to be sure of the accuracy of the calculated fundamental matrix. Using the epipolar constraint equation , I Computed fundamental matrix error. The error is very high (like a few hundreds). I do not know what is

Flatten multiple transparent PNGs with PHP GD

喜欢而已 提交于 2021-02-18 18:10:58
问题 I am building a product configuration module which requires that multiple transparent PNGs of the same size (which represent product parts) be flattened onto one image. At first I tried this which made the composition of the 3 images but on a black background: <?php $x = 500; $y = 500; $final_img = imagecreatetruecolor($x, $y); $images = array('1.png', '2.png', '3.png'); foreach ($images as $image) { $image_layer = imagecreatefrompng($image); imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x

Flatten multiple transparent PNGs with PHP GD

僤鯓⒐⒋嵵緔 提交于 2021-02-18 18:09:52
问题 I am building a product configuration module which requires that multiple transparent PNGs of the same size (which represent product parts) be flattened onto one image. At first I tried this which made the composition of the 3 images but on a black background: <?php $x = 500; $y = 500; $final_img = imagecreatetruecolor($x, $y); $images = array('1.png', '2.png', '3.png'); foreach ($images as $image) { $image_layer = imagecreatefrompng($image); imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x