Posts

Showing posts with the label image-processing

Highlight reduction in images

Highlight reduction in images I am trying to reduce the highlights in an image caused by a high intensity light source. I tried various softwares and I found that " Highlight Reduction " works for me. But I am not able to understand the actual processing behind a Highlight Reduction . Can anybody please help me regarding that ? You're going to have to give us more information. Is "Highlight Reduction" a program? (if so, add at least a link) Or is it an option in a program? (if so, which program?) – Cris Luengo Jul 2 at 5:28 I have tried this in almost all major Image edition softwares. Naming a few would be Adobe Lightroom, Snapseed for Android. – pr22 Jul 2 at 5:36 ...

How to find image border via bitmap in c#?

Image
How to find image border via bitmap in c#? i want to image border via bitmap but some pixel remaining in draw border how can i cover all border pixel in image? Datatable Data GetImageDataId PixelName PixelA PixelR PixelG PixelB PixelXCordinate PixelYCordinate 1 ffbcbcbc 255 188 188 188 0 0 2 ffb5b5b5 255 181 181 181 0 1 3 ffb7b7b7 255 183 183 183 0 2 4 ffb7b7b7 255 183 183 183 0 3 5 ffb7b7b7 255 183 183 183 0 4 Code if (dt1.Rows.Count > 0) { int p = 2; progressBar1.Visible = true; for (int r = dt1.Rows.Count - 1; r >= 1; r--) { if (dt1.Rows[r]["PixelName"].ToString() == "ffb7b7b7") { // DataTable dtf = dt1.Select("PixelYCordinate='...

Why does this order of the Gaussian filter in scipy give the x and y derivative?

Why does this order of the Gaussian filter in scipy give the x and y derivative? I'm using a Gaussian filter with Scipy and I saw this code online which I'm curious about. imx = zeros(im.shape) filters.gaussian_filter(im, (sigma,sigma), (0,1), imx) imy = zeros(im.shape) filters.gaussian_filter(im, (sigma,sigma), (1,0), imy) For the first Gaussian filter call, the order is (0,1) and according to this link, that should give the the first order derivative of a Gaussian in y-direction. However, on running the code, I can see that the Gaussian is along the X direction. The same thing applies to imy. Why does the code work that way? For reference, running: filters.gaussian_filter(im, (sigma, sigma), (0, 1), output= imx) on this array: [[0 3 2] [1 4 1] [3 4 2]] Returns: [[0.00071801 0.00148952 0.00077151] [0.0006947 0.00144284 0.00074815] [0.00067141 0.00139622 0.00072482]] Which is a Gaussian in the x direction, even though the order (0, 1) suggests that it should be in the y dire...

Importing PNG files into Numpy?

Importing PNG files into Numpy? I have about 200 grayscale PNG images stored within a directory like this. 1.png 2.png 3.png ... ... 200.png I want to import all the PNG images into Numpy and then later want to apply k-means to generate a dictionary of patches using k-means (scikit) Does anybody know a python library that could load these images into numpy on a fly? 5 Answers 5 Using just scipy, glob and having PIL installed ( pip install pillow ) you can use scipy's imread method: pip install pillow from scipy import misc import glob for image_path in glob.glob("/home/adam/*.png"): image = misc.imread(image_path) print image.shape print image.dtype UPDATE According to the doc, scipy.misc.imread is deprecated starting SciPy 1.0.0, and will be removed in 1.2.0. Consider using imageio.imread instead . See the answer by Charles. scipy.misc.imread imageio.imread instead ...

rectangle, Contour detection with python3, opencv3

Image
rectangle, Contour detection with python3, opencv3 I want to detect paper sheet from image. i applied medianBlur, Canny , dilate, threshold, etc. algorithms to find.i am able to find sheet but don't know how to crop rectangle and apply transformation answer sheet This my code import numpy as np import cv2 image = cv2.imread('im_1.jpg') image = cv2.resize(image, (800, 600)) draw = np.zeros_like(image) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ret, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3)) thresh = cv2.erode(thresh, kernel, iterations=4) thresh = cv2.dilate(thresh, kernel, iterations=4) im, cnts, hier = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) max_area = -1 max_c = 0 for i in range(len(cnts)): contour = cnts[i] area = cv2.contourArea(contour) if (area > max_area): max_area = area max_c = i contour = cnts[max_c] rect = cv2.minAreaRect(contour) ...