image-processing

Approximating jagged edges as lines

被刻印的时光 ゝ 提交于 2020-02-28 06:46:07
问题 I am trying to find accurate locations for the corners on ink blotches as seen below: My idea is to fit lines to the edges and then find where they intersect. As of now, I've tried using cv2.approxPolyDP() with various values of epsilon to approximate the edges, however this doesn't look like the way to go. My cv.approxPolyDP code gives the following result: Ideally, this is what I want to produce (drawn on paint): Are there CV functions in place for this sort of problem? I've considered

calculate illuminance from Exif Data

*爱你&永不变心* 提交于 2020-02-27 07:36:37
问题 How I calculate the lux or illuminance by iPhone Camera.I have calculated all the exif data which is as: key = FocalLength, value = 3.85 key = MeteringMode, value = 5 key = ShutterSpeedValue, value = 4.591759434012097 key = ExposureProgram, value = 2 key = FocalLenIn35mmFilm, value = 32 key = SceneType, value = 1 key = FNumber, value = 2.4 key = PixelXDimension, value = 480 key = ExposureTime, value = 0.04166666666666666 key = BrightnessValue, value = -0.2005493394308445 key = ApertureValue,

calculate illuminance from Exif Data

白昼怎懂夜的黑 提交于 2020-02-27 07:36:03
问题 How I calculate the lux or illuminance by iPhone Camera.I have calculated all the exif data which is as: key = FocalLength, value = 3.85 key = MeteringMode, value = 5 key = ShutterSpeedValue, value = 4.591759434012097 key = ExposureProgram, value = 2 key = FocalLenIn35mmFilm, value = 32 key = SceneType, value = 1 key = FNumber, value = 2.4 key = PixelXDimension, value = 480 key = ExposureTime, value = 0.04166666666666666 key = BrightnessValue, value = -0.2005493394308445 key = ApertureValue,

NodeJS Sharp Node Package Memory Consumption Issue

落爺英雄遲暮 提交于 2020-02-25 13:22:30
问题 I am working on a NodeJS project that is using sharp node package for resizing JPEG/JPG images. The problem is Node process keeps adding the processed file in memory and never releases it. As a result, amount of memory consumed increases with every request & it never gets released. After debugging the application, I realised that sharp toBuffer API is causing the issue. I tried using alternative solution by creating a custom writable stream and piping it with sharp Duplex stream but it ends

How to give an image an old, dusty appearance with faded colours?

社会主义新天地 提交于 2020-02-25 06:09:57
问题 I have images of old paintings. The paintings are old and dusty with faded colours as shown here. How do I give any image this type of an 'old' appearance? I couldn't find any filters or openCV functions to achieve this type of look? EDIT : My question is different as the other one solves the problem using the sepia filter and using the grain effect. I'm not looking for that sort of an appearance. I want my image to look like an old damaged painting. This means that the colours should be

cv2 imread returns None [duplicate]

荒凉一梦 提交于 2020-02-25 05:38:27
问题 This question already has an answer here : cv2.imread does not read jpg files (1 answer) Closed last year . I installed the cv2 library via pip install opencv-contrib-python-headless. Whenever i try to read an image it it returns None. I tried using / instead \ in the path, storing the image in the project directory so no / in the path, using r' before the path, re-installing the package. Am i missing something ? woth noting that when i use other libraries to read an image using the same path

shape detection

泄露秘密 提交于 2020-02-25 05:04:07
问题 I have tried 3 algorithms: Compare by Compare_ssim. Difference detection by PIL (ImageChops.difference). Images subtraction. The first algorithm: (score, diff) = compare_ssim(img1, img2, full=True) diff = (diff * 255).astype("uint8") The second algorithm: from PIL import Image ,ImageChops img1=Image.open("canny1.jpg") img2=Image.open("canny2.jpg") diff=ImageChops.difference(img1,img2) if diff.getbbox(): diff.show() The third algorithm: image3= cv2.subtract(image1,image2) The problem is these

Removing background color from image opencv python

百般思念 提交于 2020-02-25 03:40:09
问题 I have many images of specimen which have uncontrollable background color. Some of them have black background. Some of them have white background. Some of them have green background, etc. I would like to remove these background color of a given image where the object in the image is just only one specimen. I try this code but it does not work as i expect. def get_holes(image, thresh): gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) im_bw = cv2.threshold(gray, thresh, 255, cv2.THRESH_BINARY)[1]

extract data from the overlapping letters in a image

爱⌒轻易说出口 提交于 2020-02-24 12:21:13
问题 Input image: i want to extract the data from the image ( ocr ) code which i tried: import cv2 import textract import numpy as np img = cv2.imread('/home/ajay/Desktop/name.jpg',0) # img = cv2.imread('path_to_your_image', 0) _, blackAndWhite = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY_INV) nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S) sizes = stats[1:, -1] #get CC_STAT_AREA component img2 = np.zeros((labels.shape), np

extract data from the overlapping letters in a image

牧云@^-^@ 提交于 2020-02-24 12:20:30
问题 Input image: i want to extract the data from the image ( ocr ) code which i tried: import cv2 import textract import numpy as np img = cv2.imread('/home/ajay/Desktop/name.jpg',0) # img = cv2.imread('path_to_your_image', 0) _, blackAndWhite = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY_INV) nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S) sizes = stats[1:, -1] #get CC_STAT_AREA component img2 = np.zeros((labels.shape), np