image-processing

Is there a way to outline text with a dark line in PIL?

眉间皱痕 提交于 2020-03-18 03:43:58
问题 I'm using python/PIL to write text on a set of PNG images. I was able to get the font I wanted, but I'd like to now outline the text in black. This is what I have: as you can see, if the background is white it is difficult to read. This is the goal: Is there a way to accomplish this with PIL? If not, I am open to hearing other suggestions, but no promises because I've already begun a large project in python using PIL. The section of code that deals with drawing on the images: for i in range(0

Is there a way to outline text with a dark line in PIL?

只谈情不闲聊 提交于 2020-03-18 03:43:14
问题 I'm using python/PIL to write text on a set of PNG images. I was able to get the font I wanted, but I'd like to now outline the text in black. This is what I have: as you can see, if the background is white it is difficult to read. This is the goal: Is there a way to accomplish this with PIL? If not, I am open to hearing other suggestions, but no promises because I've already begun a large project in python using PIL. The section of code that deals with drawing on the images: for i in range(0

Alternative segmentation techniques other than watershed for soil particles in images

爷,独闯天下 提交于 2020-03-17 09:14:22
问题 I am searching for an alternative way for segmenting the grains in the following image of soil grains other than watershed segmentation in python as it may mislead the right detection for the grains furthermore , I am working on the edge detection image ( using HED algorithm ) as attached .. I hope to find a better way to segment the grains for further processing as I would like to get the area of each polygon in the image in my project .. Thanks in advance I am asking also about random

Image Processing: Algorithm Improvement for Real-Time FedEx Logo Detector

孤人 提交于 2020-03-17 05:47:04
问题 I've been working on a project involving image processing for logo detection. Specifically, the goal is to develop an automated system for a real-time FedEx truck/logo detector that reads frames from a IP camera stream and sends a notification on detection. Here's a sample of the system in action with the recognized logo surrounded in the green rectangle. Some constraints on the project: Uses raw OpenCV (no deep learning, AI, or trained neural networks) Image background can be noisy The

How to display 16-bit 4096 intensity image in Python openCV?

点点圈 提交于 2020-03-16 05:44:08
问题 I have images encoded in grayscale 16-bit tiff format. They use a variant of 16-bit color depth where the max intensity is 4,096. I believe the default max intensity in openCV is 65,536, so my image shows up as black using the following code. import cv2 image = cv2.imread("test.tif", -1) cv2.imshow('tiff', image) cv2.waitKey(0) cv2.destroyAllWindows() print(image) I can use vmin and vmax in matplotlib to configure the color mapping: import cv2 import matplotlib.pyplot as plt image = cv2

Detect multiple colored regions in image and produce individual crops for each

纵饮孤独 提交于 2020-03-11 13:30:29
问题 I have an image like this: And I want to crop the image anywhere there is red . So with this image I would be looking to produce 4 crops : Obviously I first need to detect anywhere there is red in the image . I can do the following: import cv2 import numpy as np from google.colab.patches import cv2_imshow ## (1) Read and convert to HSV img = cv2.imread("my_image_with_red.png") hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) ## (2) Find the target red region in HSV hsv_lower = np.array([0,50,50])

Cleaning image for OCR

可紊 提交于 2020-03-10 14:41:20
问题 I've been trying to clear images for OCR: (the lines) I need to remove these lines to sometimes further process the image and I'm getting pretty close but a lot of the time the threshold takes away too much from the text: copy = img.copy() blur = cv2.GaussianBlur(copy, (9,9), 0) thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9)) dilate = cv2.dilate(thresh, kernel, iterations=2) cnts =

Cleaning image for OCR

吃可爱长大的小学妹 提交于 2020-03-10 14:37:11
问题 I've been trying to clear images for OCR: (the lines) I need to remove these lines to sometimes further process the image and I'm getting pretty close but a lot of the time the threshold takes away too much from the text: copy = img.copy() blur = cv2.GaussianBlur(copy, (9,9), 0) thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9)) dilate = cv2.dilate(thresh, kernel, iterations=2) cnts =

Cleaning image for OCR

时光毁灭记忆、已成空白 提交于 2020-03-10 14:36:00
问题 I've been trying to clear images for OCR: (the lines) I need to remove these lines to sometimes further process the image and I'm getting pretty close but a lot of the time the threshold takes away too much from the text: copy = img.copy() blur = cv2.GaussianBlur(copy, (9,9), 0) thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9)) dilate = cv2.dilate(thresh, kernel, iterations=2) cnts =

Cleaning image for OCR

十年热恋 提交于 2020-03-10 14:35:30
问题 I've been trying to clear images for OCR: (the lines) I need to remove these lines to sometimes further process the image and I'm getting pretty close but a lot of the time the threshold takes away too much from the text: copy = img.copy() blur = cv2.GaussianBlur(copy, (9,9), 0) thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9)) dilate = cv2.dilate(thresh, kernel, iterations=2) cnts =