image-processing

Recognize pattern in images

三世轮回 提交于 2020-01-24 19:53:14
问题 I am looking for a fast idea/algorithm letting me to find squares (as mark points) in the image file. It shouldn't be so much challenge, however... I started doing this by changing the color of the source image to a grey scale image and scanning each line of the image looking for two, three longest lines (pixel by pixel). Then having an array of "lines" I am finding elements which may create the desire square. The better idea would be to find the pattern with known traits, like: it is square,

Efficient way of making checkers from connected components

℡╲_俬逩灬. 提交于 2020-01-24 15:29:16
问题 I have a binary image of several connected components, some large and some small (maybe only 1 pixel). With this I am seeking a way to make each connected component into a checkers pattern, instead of the connected blobs, in an efficient way. So far I have come up with two ways this could be tried, but they can either produce errors, or be quite unefficient: I know the entire image and can make a checkers pattern mask to remove 50% of the pixels. This is very fast, but will on average remove

Efficient way of making checkers from connected components

北慕城南 提交于 2020-01-24 15:28:43
问题 I have a binary image of several connected components, some large and some small (maybe only 1 pixel). With this I am seeking a way to make each connected component into a checkers pattern, instead of the connected blobs, in an efficient way. So far I have come up with two ways this could be tried, but they can either produce errors, or be quite unefficient: I know the entire image and can make a checkers pattern mask to remove 50% of the pixels. This is very fast, but will on average remove

Efficient way of making checkers from connected components

蓝咒 提交于 2020-01-24 15:28:04
问题 I have a binary image of several connected components, some large and some small (maybe only 1 pixel). With this I am seeking a way to make each connected component into a checkers pattern, instead of the connected blobs, in an efficient way. So far I have come up with two ways this could be tried, but they can either produce errors, or be quite unefficient: I know the entire image and can make a checkers pattern mask to remove 50% of the pixels. This is very fast, but will on average remove

What is difference between setImageCompressionQuality vs setCompressionQuality - Imagick

妖精的绣舞 提交于 2020-01-24 14:46:26
问题 I found two methods in Imagick for set image compression quality A ) setImageCompressionQuality B ) setCompressionQuality so I want to know which one is best and why in below condition I read that setCompressionQuality method only works for new images (?) I am trying to compress a file jpeg/png $im = new Imagick(); $im->readImage($file); // path/to/file $im->setImageCompressionQuality($quality); // 90,80,70 e.g. $im->writeImage($file); 回答1: The method setImageCompressionQuality sets

What is difference between setImageCompressionQuality vs setCompressionQuality - Imagick

风流意气都作罢 提交于 2020-01-24 14:43:34
问题 I found two methods in Imagick for set image compression quality A ) setImageCompressionQuality B ) setCompressionQuality so I want to know which one is best and why in below condition I read that setCompressionQuality method only works for new images (?) I am trying to compress a file jpeg/png $im = new Imagick(); $im->readImage($file); // path/to/file $im->setImageCompressionQuality($quality); // 90,80,70 e.g. $im->writeImage($file); 回答1: The method setImageCompressionQuality sets

FFT based image registration in python

谁说胖子不能爱 提交于 2020-01-24 13:47:41
问题 I found simple code in python for image registration here in simple case of translation we have: def translation(im0, im1): """Return translation vector to register images.""" shape = im0.shape f0 = fft2(im0) f1 = fft2(im1) ir = abs(ifft2((f0 * f1.conjugate()) / (abs(f0) * abs(f1)))) t0, t1 = numpy.unravel_index(numpy.argmax(ir), shape) if t0 > shape[0] // 2: t0 -= shape[0] if t1 > shape[1] // 2: t1 -= shape[1] return [t0, t1] but I don't understand this part: if t0 > shape[0] // 2: t0 -=

floodfill algorithm - leaving out the edge

ぐ巨炮叔叔 提交于 2020-01-24 11:29:47
问题 so far i have implemented a floodfill algorithm. I wanted to tweak it, so that it would leave out the edge. To demonstrate this i uploaded an image: Image 1 is the image that i want to modify. Image 3 is what my algorithm is supposed to do. Image 2 is my current result. So in this case the targetColor is white and the replacementColor is green; Here is pseudocode of what i have done so far. doFloodFill(x,y,targetColor,replacementcolor) { if (x and y not in bounds of image) { return } if

Replacing indices with an unwanted value with their the nearest index's value that happens to be positive

一笑奈何 提交于 2020-01-24 09:31:49
问题 This question is different from the previous question (How to find indices with a negative value and replace the value with the nearest index's value that happens to be positive?). The previous question was to replace an index's unwanted value with its nearest positive index's value on the same row . This question is to replace the unwanted value with its nearest positive index's value throughout the entire matrix (not only limited to the same row) . If there is more than one index that is

Find extreme outer points in image with Python OpenCV

霸气de小男生 提交于 2020-01-24 03:25:26
问题 I have this image of a statue. I'm trying to find the top, bottom, left, and right most points on the statue. Is there a way to measure the edge of each side to determine the outer most point on the statue? I want to get the (x,y) coordinate of each side. I have tried to use cv2.findContours() and cv2.drawContours() to get an outline of the statue. import cv2 img = cv2.imread('statue.png') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) contours = cv2.findContours(gray, cv2.RETR_TREE, cv2.CHAIN