image-processing

why weiner filter reduces only noise in my case, it is not reducing blur amount

不羁岁月 提交于 2021-01-29 14:28:22
问题 I am implementing weiner filtering in python which is applied on an image blurred using disk shape point spread function, i am including code of making disk shape psf and weiner filter def weinerFiltering(kernel,K_const,image): #F(u,v) copy_img= np.copy(image) image_fft =np.fft.fft2(copy_img) #H(u,v) kernel_fft = np.fft.fft2(kernel,s=copy_img.shape) #H_mag(u,v) kernel_fft_mag = np.abs(kernel_fft) #H*(u,v) kernel_conj = np.conj(kernel_fft) f = (kernel_conj)/(kernel_fft_mag**2 + K_const) return

Get a vignette effect by shaders

旧巷老猫 提交于 2021-01-29 11:16:15
问题 Im trying to create a vignette effect for my app. I've been searching a lot for help achieving this but was unable to find anything. I recently found this tutorial. And i tried to implement it in my app with this code: public int[] drawBitmap(Bitmap originalBitmap){ Bitmap mask; Paint paint = new Paint(); mask = convertToAlphaMask(BitmapFactory.decodeResource(context.getResources(), R.drawable.spot_mask)); Shader shader = createShader(mask); paint.setShader(shader); Bitmap tempBit = Bitmap

What is an Image Gradient?

前提是你 提交于 2021-01-29 10:48:51
问题 I am currently, learning the working of Seam Carving aka Content Aware Resizing . Seam Carving involves calculation of Energy of Each individual pixel in an image. Where the Energy could be calculated using several methods, one of which being Gradient Magnitude (Image Gradient). I have previously used Sobel Filter/Operator , which involves calculation of gradients in X and Y direction, where the output of the two is used for finding edges. But, I am not quite sure what a Gradient is by

Iterate over each pixel of Mat in EmguCV

蓝咒 提交于 2021-01-29 10:45:37
问题 I want to assign the value to each pixel of Mat in EmguCV using C#. I have read the documentation but doesn't find any way to do this. I have able to do this with Image but I want to do this with Mat . So, can anyone please tell me how to do this. 回答1: In EmguCV you can use Data method to get the value of each pixel but as per written in Documentation you cannot reallocate it. What I get to know from your question is that you want to put the color value of each pixel to variable of Mat class.

Loading data from Custom Data-Loader in pytorch only if the data specifies a certain condition

南笙酒味 提交于 2021-01-29 09:32:14
问题 I have a CSV file with filename in the first column and a label for the filename in the second column. I also have a third column, which specifies something about the data (whether the data meets a specific condition). It will look something like, +-----------------------------+ | Filepath 1 Label 1 'n' | | | +-----------------------------+ | Filepath 2 Label 2 'n' | | | | | +-----------------------------+ | Filepath 3 Label 3 'n'| | | +-----------------------------+ | Filepath 4 Label 4 'y'|

How to plot epoch vs. val_acc and epoch vs. val_loss graph in CNN?

混江龙づ霸主 提交于 2021-01-29 09:27:09
问题 I used a convolutional neural network (CNN) for training a dataset. Here I get epoch, val_loss, val_acc, total loss, training time, etc. as a history. If I want to calculate the average of accuracy, then how to access val_acc, and how to plot epoch vs. val_acc and epoch vs. val_loss graph? convnet = input_data(shape=[None, IMG_SIZE, IMG_SIZE, 3], name='input') convnet = conv_2d(convnet, 32, 3, activation='relu') convnet = max_pool_2d(convnet, 3) convnet = conv_2d(convnet, 64, 3, activation=

Detect object by name of card and crop it using openCV

孤街醉人 提交于 2021-01-29 08:41:21
问题 I have a image with ID card, Bank card and signature i want to get id_card.jpg and bank_card.jpg and signature.jpg . The problem ID card and Bank card has the same width and height, i don't know how to detect each other. But the color is different suggestion possible get by color or the best idea is to get name of each card and after crop each card by name ?? I'm so new in this domain and i work in emergency project that why i will very grateful if someone can help me. The image look like

Why pytesseract raise an error with Arabic language

半世苍凉 提交于 2021-01-29 07:23:58
问题 I want to use pytesseract Arabic And I have ara.traineddata in my system /usr/share/tesseract/tessdata/ path and i have already installed tesseract package This is my code: import pytesseract from PIL import Image pytesseract.image_to_string(Image.open('test_arabic.png'), config='', lang="ara") and i get this error: TesseractError Traceback (most recent call last) in ----> 1 pytesseract.image_to_string(Image.open('test_persian.png'), config='', lang="ara") ~/.local/lib/python3.8/site-packages

how to find the template matching accuracy

别来无恙 提交于 2021-01-29 06:55:50
问题 i am doing a template matching now,what i want to do is find the accuracy of template matching I have done template matching, but how do i get the accuracy i think i have to subtract the matched region and template image. how do i achieve this CODE import cv2 as cv import numpy as np import matplotlib.pyplot as plt img = cv.imread('image.jpg',0) img1 = img.copy() template = cv.imread('template.jpg',0) w, h = template.shape[::-1] method = ['cv.TM_CCOEFF_NORMED','cv.TM_CCORR_NORMED'] for meth

Crop Image with multiple X and Y points c#

人盡茶涼 提交于 2021-01-29 06:46:27
问题 I have images that I need to crop and have multiple X,Y co-ordinates to cut out the business card or paper. What would be the best way to do it. My Co Ordinates is the following. X: 490, y: 0 X: 1442, y: 0 X: 1442, y: 4031 X: 490, y: 4031 回答1: You could check out the KeyStoneCommand from the Leadtools Image Processing Nuget This Nuget package also includes a detect document ip command that you can use if you don't know the bounding box of the business card that will detect and give you back