image-processing

Resizing images in Keras ImageDataGenerator flow methods

二次信任 提交于 2020-01-24 02:08:23
问题 The Keras ImageDataGenerator class provides the two flow methods flow(X, y) and flow_from_directory(directory) (https://keras.io/preprocessing/image/). Why is the parameter target_size: tuple of integers, default: (256, 256). The dimensions to which all images found will be resized Only provided by flow_from_directory(directory) ? And what is the most concise way to add reshaping of images to the preprocessing pipeline using flow(X, y) ? 回答1: flow_from_directory(directory) generates augmented

OCR : Not getting desired result

雨燕双飞 提交于 2020-01-24 01:19:29
问题 I have this image . I am trying to OCR the letters in this image. I am not getting desired result for letters '9' and 'R'. First I cropped these letters, & and executing following command. tesseract 9.png stdout -psm 8 . It is just returning "." OCR for all other letters are working fine but not for these two letters(though, I think their image quality is not that bad). Any suggestion/help is appreciated. 回答1: I've no experience with tesseract myself, but replicating the character and adding

Image resize on Upload Issue

半腔热情 提交于 2020-01-23 17:32:16
问题 Having an issue getting an image resized on upload. Function // Image Resizer function MakeThumbnail($inputFile, $filepath, $ext, $maxWidth, $maxHeight) { if($ext=="jpg" || $ext=="jpeg" ){ $src = imagecreatefromjpeg($inputFile); }else if($ext=="png"){ $src = imagecreatefrompng($inputFile); }else { $src = imagecreatefromgif($inputFile); } list($width, $height) = getimagesize($inputFile); $newwidth = $maxWidth; $newheight = (strlen($maxHeight)>0) ? $maxHeight : ($height / $width) * $newwidth;

Find [x,y] rotated coordinates locations in image [OpenCV / Python]

冷暖自知 提交于 2020-01-23 16:21:45
问题 I want to rotate an image at several angles sequentially. I do that using cv2.getRotationMatrix2D and cv2.warpAffine . Having a pair of pixels coordinates [x,y], where x=cols, y=rows (in this case) I want to find their new coordinates in the rotated images. I used the following slightly changed code courtesy of http://www.pyimagesearch.com/2017/01/02/rotate-images-correctly-with-opencv-and-python/ and the explanation from Affine Transformation to try to map the points in the rotated image :

Find [x,y] rotated coordinates locations in image [OpenCV / Python]

怎甘沉沦 提交于 2020-01-23 16:21:34
问题 I want to rotate an image at several angles sequentially. I do that using cv2.getRotationMatrix2D and cv2.warpAffine . Having a pair of pixels coordinates [x,y], where x=cols, y=rows (in this case) I want to find their new coordinates in the rotated images. I used the following slightly changed code courtesy of http://www.pyimagesearch.com/2017/01/02/rotate-images-correctly-with-opencv-and-python/ and the explanation from Affine Transformation to try to map the points in the rotated image :

remove background of any image using opencv

不羁的心 提交于 2020-01-23 15:39:09
问题 I have been searching for a technique to remove the background of a any given image. The idea is to detect a face and remove the background of the detected face. I have finished the face part. Now removing the background part still exists. I used this code. import cv2 import numpy as np #== Parameters BLUR = 21 CANNY_THRESH_1 = 10 CANNY_THRESH_2 = 200 MASK_DILATE_ITER = 10 MASK_ERODE_ITER = 10 MASK_COLOR = (0.0,0.0,1.0) # In BGR format #-- Read image img = cv2.imread('SYxmp.jpg') gray = cv2

remove background of any image using opencv

隐身守侯 提交于 2020-01-23 15:37:39
问题 I have been searching for a technique to remove the background of a any given image. The idea is to detect a face and remove the background of the detected face. I have finished the face part. Now removing the background part still exists. I used this code. import cv2 import numpy as np #== Parameters BLUR = 21 CANNY_THRESH_1 = 10 CANNY_THRESH_2 = 200 MASK_DILATE_ITER = 10 MASK_ERODE_ITER = 10 MASK_COLOR = (0.0,0.0,1.0) # In BGR format #-- Read image img = cv2.imread('SYxmp.jpg') gray = cv2

How to warp a rectangular object to fit its larger bounding box

风流意气都作罢 提交于 2020-01-23 12:53:53
问题 Given this image: I'd like to make it such that it will rotate and stretch to fully fit in the bounding box with no whitespace on the outside of the largest rectangular box. It should also account for worse perspective case, like in the links I list later on. Basically, while it is not noticeable, the rectangle is rotated a little bit, and I'd like to fix that distortion. However, I got an error when attempting to retrieve the four points of the contour. I have made sure and utilized contour

How to warp a rectangular object to fit its larger bounding box

我们两清 提交于 2020-01-23 12:53:53
问题 Given this image: I'd like to make it such that it will rotate and stretch to fully fit in the bounding box with no whitespace on the outside of the largest rectangular box. It should also account for worse perspective case, like in the links I list later on. Basically, while it is not noticeable, the rectangle is rotated a little bit, and I'd like to fix that distortion. However, I got an error when attempting to retrieve the four points of the contour. I have made sure and utilized contour

How to warp a rectangular object to fit its larger bounding box

心不动则不痛 提交于 2020-01-23 12:53:51
问题 Given this image: I'd like to make it such that it will rotate and stretch to fully fit in the bounding box with no whitespace on the outside of the largest rectangular box. It should also account for worse perspective case, like in the links I list later on. Basically, while it is not noticeable, the rectangle is rotated a little bit, and I'd like to fix that distortion. However, I got an error when attempting to retrieve the four points of the contour. I have made sure and utilized contour