pixel

It is taking too much time to process frames while doing pixel by pixel operation of video frames

爱⌒轻易说出口 提交于 2021-01-28 20:13:07
问题 import cv2 import numpy as np cap = cv2.VideoCapture(0) def threshold_slow(image): h = image.shape[0] w = image.shape[1] for x in range(0, w): for y in range(0, h): k = np.array(image[x, y]) print(k) def video(): while True: ret,frame = cap.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) threshold_slow(frame) cv2.imshow('frame',frame) key = cv2.waitKey(25) if key == ord('q'): break if __name__ == '__main__': video() cap.release() cv2.destroyAllWindows() I have done almost everything I

ImageMagick: custom rank filter? Like erode or dilate or median but a different rank, e.g. a 'percentile' filter?

假如想象 提交于 2021-01-28 05:40:38
问题 When applying a rank filter with ImageMagick such as erode or delate or median, it takes the minimum ( erode ) or maximum ( dilate ) or middle ( median ) value of all pixels within a certain radius or custom shape around each source pixel. Is it also possible to take a custom rank of the surrounding pixel values? For example when using a 5x5 square, with the erode or dilate or median filters, respectively the lowest, highest, of middle value of the 25 pixels surrounding each pixel is taken.

Blurry pixel paint on scaled canvas drawBitmap on Samsung devices

雨燕双飞 提交于 2021-01-28 05:20:36
问题 Some users encountered blurry pixels issue on Samsung devices. I don't have any Samsung device to check, but there is no problems with phones I have. I can't understand what is different on Samsung and why there is no issue with other devices! It will be very nice if someone could help me to understand! Thank you! How it looks on samsung My code: protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); canvas.translate(imagePosition.getX(), imagePosition.getY()); canvas

Image Spiral Pixel Search

六眼飞鱼酱① 提交于 2021-01-28 02:42:06
问题 I'm trying to figure out how to do a pixel (color) search from the center and out, in a spiral shape.. Not like the normal "left to right pixel search". So far i've made some simple x-y searches. Using standard PIL. But it was to slow. as the result always seems to be closer to the center (of the image) in my case. The thing is that it's not a square image, so the center position(s) can be 2 or more pixels (not A center, but "two"+ pixels centerd), this is where I "loose it".. Can you peeps

Store all QImage's pixels with scanLine() method in C++

懵懂的女人 提交于 2021-01-27 19:15:38
问题 I am trying to modify an image using Qt with the scanLine() method. This methods return a pointer to the data of a given row. I founded how to read rows here. Right now, I am able to read the value of all pixels like this: QRgb ** pixels; pixels = (QRgb **) (malloc(sizeof (QRgb*) * img->width() * img->height())); #pragma omp parallel for for (int y = 0; y < img->height(); ++y) { pixels[y] = (QRgb*) img->scanLine(y); } for (int x = 0; x < img->width(); ++x) { for (int y = 0; y < img->height();

Puzzled by pixel value in Bitmap (pre multiplied color using setPixel)

泪湿孤枕 提交于 2021-01-27 06:40:37
问题 I cannot explain this (screenshot from Eclipse debug): Pixel at (0,0) does not have the values it was set for! All other pixels are fine, they do have the same value they were assigned to. EDIT I did some more digging, and the code for setPixel is calling a native function: 1391 public void setPixel(int x, int y, int color) { 1392 checkRecycled("Can't call setPixel() on a recycled bitmap"); 1393 if (!isMutable()) { 1394 throw new IllegalStateException(); 1395 } 1396 checkPixelAccess(x, y);

Puzzled by pixel value in Bitmap (pre multiplied color using setPixel)

半城伤御伤魂 提交于 2021-01-27 06:39:36
问题 I cannot explain this (screenshot from Eclipse debug): Pixel at (0,0) does not have the values it was set for! All other pixels are fine, they do have the same value they were assigned to. EDIT I did some more digging, and the code for setPixel is calling a native function: 1391 public void setPixel(int x, int y, int color) { 1392 checkRecycled("Can't call setPixel() on a recycled bitmap"); 1393 if (!isMutable()) { 1394 throw new IllegalStateException(); 1395 } 1396 checkPixelAccess(x, y);

What's the theory behind computing variance of an image?

萝らか妹 提交于 2020-12-29 06:07:33
问题 I am trying to compute the blurriness of an image by using LaplacianFilter. According to this article: https://www.pyimagesearch.com/2015/09/07/blur-detection-with-opencv/ I have to compute the variance of the output image. The problem is I don't understand conceptually how do I compute variance of an image. Every pixel has 4 values for every color channel, therefore I can compute the variance of every channel, but then I get 4 values, or even 16 by computing variance-covariance matrix, but

Handling alpha channel in WPF pixel shader effect

一曲冷凌霜 提交于 2020-12-29 05:53:27
问题 Is there something unusual about how the alpha component is handled in a pixel shader? I have a WPF application for which my artist is giving me grayscale images to use as backgrounds, and the application colorizes those images according to the current state. So I wrote a pixel shader (using the WPF Pixel Shader Effects Library infrastructure) to use as an effect on an Image element. The shader takes a color as a parameter, which it converts to HSL so it can manipulate brightness. Then for

Detection of certain pixels of a grayscale image

ぃ、小莉子 提交于 2020-12-13 07:08:18
问题 I have this code that allows you to detect pixels of a vertain value. Right now I'm detecting pixels over a certain value (27). My idea would be to still detect them but to detect another pixel values (I want to detec pixels from 65 to 75, another interval of pixels). How can I do this? As you may see, T'm detecting grayscale images, so I have this same value for red, green and blue. Any idea to improve this program in order to work faster would be really appreciated. Sucha as using os.walk