scikit-image

drawing a bounding box in large images

半腔热情 提交于 2019-12-02 06:09:50
问题 I have a large binary image (4k x 7k pix) from which I want to extract the entire yellow portion as a single rectangle. I tried binary erosion to even out features inside the yellow region. Then I used the bbox method of skimage.regionprops but it does not seem to work fast enough for large image with one large bbox. Do you have any suggestion? 回答1: As the image you provided includes distracting axes, and is the wrong colour and too small, I created as realistic a version as I could with

ellipse detection in opencv python

半城伤御伤魂 提交于 2019-12-01 13:39:46
My image is here: i'm looking for a better solution or algorithm to detect the ellipse part (dish) in this photo and mask it in an other photo in Opencv. could you please give me some advice or solution. and my code is : circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1.2, 1, param1=128, minRadius=200, maxRadius=600) # draw detected circles on image circles = circles.tolist() for cir in circles: for x, y, r in cir: x, y, r = int(x), int(y), int(r) cv2.circle(img, (x, y), r, (0, 255, 0), 4) # show the output image cv2.imshow("output", cv2.resize(img, (500, 500))) There is an alternative for

ellipse detection in opencv python

蓝咒 提交于 2019-12-01 12:32:44
问题 My image is here: i'm looking for a better solution or algorithm to detect the ellipse part (dish) in this photo and mask it in an other photo in Opencv. could you please give me some advice or solution. and my code is : circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1.2, 1, param1=128, minRadius=200, maxRadius=600) # draw detected circles on image circles = circles.tolist() for cir in circles: for x, y, r in cir: x, y, r = int(x), int(y), int(r) cv2.circle(img, (x, y), r, (0, 255, 0), 4

How to get the external contour of a floorplan in python?

别来无恙 提交于 2019-12-01 07:42:38
问题 What is the best way to get a floorplan external contour? Snakes algorithm doesn't work well because some floorplans are too convex. 回答1: You just need to adjust the threshold of the grayScale image to include the gray dotted lines path while finding the contours, As the major part of input image is white so we can choose the threshold close to 255, say 230. And then find the contours thresholding. You may use cv2.approxPolyDP to calculate the approximate polynomial shape, but it won't help

Choosing/Normalizing HoG parameters for object detection?

廉价感情. 提交于 2019-11-30 23:47:36
I'm using HoG features for object detection via classification. I'm confused about how to deal with HoG feature vectors of different lengths. I've trained my classifier using training images that all have the same size. Now, I'm extracting regions from my image on which to run the classifier - say, using the sliding windows approach. Some of the windows that I extract are a lot bigger than the size of images the classifier was trained on. (It was trained on the smallest possible size of the object that might be expected in test images). The problem is, when the windows I need to classify are

Choosing/Normalizing HoG parameters for object detection?

喜夏-厌秋 提交于 2019-11-30 17:22:01
问题 I'm using HoG features for object detection via classification. I'm confused about how to deal with HoG feature vectors of different lengths. I've trained my classifier using training images that all have the same size. Now, I'm extracting regions from my image on which to run the classifier - say, using the sliding windows approach. Some of the windows that I extract are a lot bigger than the size of images the classifier was trained on. (It was trained on the smallest possible size of the

ImportError: cannot import name '_validate_lengths'

蹲街弑〆低调 提交于 2019-11-30 16:46:36
I have started learning Tensorflow. I am using Pycharm and my environment is Ubuntu 16.04. I am following the tutorial . I cross check the nump. It is up-to-date. I don't know the reason of this error. from numpy.lib.arraypad import _validate_lengths ImportError: cannot import name '_validate_lengths' Need hint to resolve this error. Thank you. import tensorflow as tf from skimage import transform from skimage import data import matplotlib.pyplot as plt import os import numpy as np from skimage.color import rgb2gray import random #listdir: This method returns a list containing the names of the

ZeroDivisionError (Python)

百般思念 提交于 2019-11-30 16:08:26
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 = cnts[0] if imutils.is_cv2() else cnts[1] # loop over the contours for c in cnts: # compute the center

How to crop or remove white background from an image

元气小坏坏 提交于 2019-11-30 12:19:52
问题 I am trying to compare images using OpenCV and Python. Consider these images: Both feature an identical pair of shoes, set to a white background. The only difference being that the first has a taller background than the second. I want to know how to programmatically crop the white backgrounds of both so that I'm left with only the pair of shoes. I must add that it won't be possible for me to manually crop the backgrounds. 回答1: You requirement in the comment: The shoes are on a white

Python: taking the GLCM of a non-rectangular region

家住魔仙堡 提交于 2019-11-30 09:47:08
问题 I have been using the SLIC implementation of skimage to segment images in superpixels. I would like to use GLCMs to extract additional features from these superpixels for a classification problem. These superpixels are not rectangular. In MATLAB you can set pixels to NaN and they will be ignored by the algorithm (link). I could use this to make bounding boxes around the superpixels and then just setting the unused pixels to NaN. The greycomatrix function in skimage does not work entirely the