scikit-image

Training a classifier using images of different dimensions but same number of HoG features

元气小坏坏 提交于 2020-01-04 14:04:06
问题 I want to train my classifier with some images, some of which have different dimensions. They all fall under the following dimensions: 100x50 50x100 64x72 72x64 However, with 9 orientation bins, and 8 pixels per cell, each of these generates 648 HoG features. I actually chose all images to be of one of these sizes so that they would end up having the same number of HoG features so that training is uniform. The reason I opted for this is because the object of interest in the training images

Align x-ray images: find rotation, rotate and crop

你。 提交于 2020-01-03 01:44:07
问题 I want in the x-ray image below to (by using Python): identify the rotation of the (imperfect) rectangle block rotate the image so that it is in vertical (portrait form) remove by cropping the remaining white space I guess this partly the reverse of this question where the tools are most likely identical with the addition of a corner detector. I'm not entirely sure of how to best approach this and it seems like a problem that someone has solved. 回答1: This can be done using the Python bindings

ZeroDivisionError (Python)

耗尽温柔 提交于 2019-12-30 05:34:05
问题 I am getting a Zero Division Error with some images (Even though a lot of them work just fine) : Here's the code : image = skimage.io.imread('test.png', False) image_gray = skimage.io.imread('test.png', True) blurred = cv2.GaussianBlur(img_as_ubyte(image_gray), (5, 5), 0) thresh = threshold_li(blurred) binary = blurred > thresh binary_cv2 = img_as_ubyte(binary) # find contours in the thresholded image cnts = cv2.findContours(binary_cv2.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cnts

How do I remove the background from this kind of image?

自古美人都是妖i 提交于 2019-12-27 16:28:48
问题 I want to remove the background of this image to get the person only. I have thousand of images like this, basically, a person and a somewhat whitish background. What I have done is to use edge detector like canny edge detector or sobel filter (from skimage library). Then what I think possible to do is, whiten the pixels within the edges and blacken the pixels without. Afterwards, the original image can be mask to get the picture of the person only. However, it's hard to get a closed boundary

How do I remove the background from this kind of image?

爱⌒轻易说出口 提交于 2019-12-27 16:26:34
问题 I want to remove the background of this image to get the person only. I have thousand of images like this, basically, a person and a somewhat whitish background. What I have done is to use edge detector like canny edge detector or sobel filter (from skimage library). Then what I think possible to do is, whiten the pixels within the edges and blacken the pixels without. Afterwards, the original image can be mask to get the picture of the person only. However, it's hard to get a closed boundary

How to produce a 2D cut through a 3D image?

≡放荡痞女 提交于 2019-12-25 12:48:05
问题 I have a 3D array with some data (a raster 3D image). I would like to get a 2D cut through that array, using some suitable interpolation (preferably linear - that's probably "trilinear" in this case). The plane of the cut can be described however is convenient, for example using a normal vector and distance. If the cut is parallel to one of the axes, this is trivial, just slice the 3D array (with numpy index slice). But if the cut is not parallel to an axis, I don't see a good way to get

Why performing an histogram equalization by scikit image to a binary image i got a black image after mahotas conversion?

百般思念 提交于 2019-12-25 11:55:14
问题 I used histogram equalization and adaptation for erase illumination from the grayscale images , but after the histogram equalization (i used scikit image python library) was good, during image conversion in mahotas something goes wrong. I got a picture total black. How can i fix it? Source image: Histogram equalization and adaptation; Result after mahotas conversion. conversion code from scikit to mahotas: binimg = np.array(img_adapteq, dtype=np.bool) Source code: import scipy import numpy as

How can I change colors in contours (obtained from non-Python) with Python?

落花浮王杯 提交于 2019-12-25 02:26:34
问题 I am trying to convert the color map of a contour generated from non-Python application. I tried using Matthias Bussonnier's code available here, but is unable to give me a full conversion. I tried to truncate the color map to give me a full conversion, but again does not give me a complete conversion. MWE import matplotlib.pyplot as plt import numpy as np import matplotlib.colors as colors import matplotlib.image as mpimg from scipy.spatial import cKDTree import matplotlib import matplotlib

Using Skimage adaptive thresholding on an image and getting the output

无人久伴 提交于 2019-12-24 20:54:28
问题 I am trying to use scikit-image's adaptive threshold on my image. I tested out their sample code from HERE import matplotlib.pyplot as plt from skimage import data from skimage.filters import threshold_otsu, threshold_adaptive image = data.page() global_thresh = threshold_otsu(image) binary_global = image > global_thresh block_size = 35 binary_adaptive = threshold_adaptive(image, block_size, offset=10) fig, axes = plt.subplots(nrows=3, figsize=(7, 8)) ax0, ax1, ax2 = axes plt.gray() ax0

Plotting a graph on axes but getting no results while trying to classify image based on HoG features

烈酒焚心 提交于 2019-12-24 11:39:37
问题 I need to use boosted cascaded training to classify some images in scikit-learn. I want to classify according to HoG features. My code below is adapted from this example. This part of the code is the only thing that I've really done: import sys from scipy import misc, ndimage from skimage import data, io, filter, color, exposure from skimage.viewer import ImageViewer from skimage.feature import hog from skimage.transform import resize import matplotlib.pyplot as plt from sklearn.datasets