image-segmentation

How to identify incomplete rectangles in openCV

℡╲_俬逩灬. 提交于 2019-11-29 08:02:14
How would I go around identifying and extracting rectangles from an image such as the one shown below. Note that my rectangles might be incomplete and have some missing edges and some sides might be partial lines. Thanks ! This can be solved using morphological operations such as eroding and dilating . This two operations will help creating closed rectangles. After that you can use the tutorial from this page to detect simple shapes such as rectangles. I implemented a quick demo which worked for the image you provided. main.py: import cv2 import numpy as np from shapeDetector import

Cutting one image into multiple images using the Python Image Library

限于喜欢 提交于 2019-11-29 03:44:21
I need to cut this image into three parts using PIL and pick the middle part. How do I do it? http://thedilbertstore.com/images/periodic_content/dilbert/dt110507dhct.jpg If the boxes are not known on before hand I would run a simple edge finding filter over the image (both x and y directions) to find the boundaries of the box. A simple approach would be: Run horizontal edge filter over image. You now have an image where each pixel describes the changes in intensity left and right of that pixel. I.e. it will "find" vertical lines. For each column in the horizontal-edge-image get the average

Segmentation for connected characters

北城以北 提交于 2019-11-29 01:14:00
问题 How can I segment if the characters are connected? I just tried using watershed with distance transform (http://opencv-code.com/tutorials/count-and-segment-overlapping-objects-with-watershed-and-distance-transform/) to find the number of components but it seems that it does not perform well. It requires the object to be separated after a threshold in order to perform well. Having said so, how can I segment the characters effectively? Need helps/ideas. As attached is the example of binary

Finding the local maxima/peaks and minima/valleys of histograms

不打扰是莪最后的温柔 提交于 2019-11-29 01:02:34
问题 Ok, so I have a histogram (represented by an array of ints), and I'm looking for the best way to find local maxima and minima. Each histogram should have 3 peaks, one of them (the first one) probably much higher than the others. I want to do several things: Find the first "valley" following the first peak (in order to get rid of the first peak altogether in the picture) Find the optimum "valley" value in between the remaining two peaks to separate the picture I already know how to do step 2

watershed algorithm in matlab

旧街凉风 提交于 2019-11-28 23:55:50
anyone knows how to write a function in matlab to segment the cells and compute the average cell area using the watershed algorithm ? any help would be much appreciated. Thank you! Here is an image of yeast cells Jonas Here's one way to segment the image using watershed. There's plenty more you could do (e.g. fuse cells with two nuclei if they haven't completed cytokinesis yet), but the steps below should give you a first idea. (1) Determine cell-background threshold, cell-nucleus threshold %# read image img = imread('http://i.stack.imgur.com/nFDkX.png'); %# normalize to 0...1 imgN = double

scipy signal find_peaks_cwt not finding the peaks accurately?

你说的曾经没有我的故事 提交于 2019-11-28 19:33:16
I've got a 1-D signal in which I'm trying to find the peaks. I'm looking to find them perfectly. I'm currently doing: import scipy.signal as signal peaks = signal.find_peaks_cwt(data, np.arange(100,200)) The following is a graph with red spots which show the location of the peaks as found by find_peaks_cwt() . As you can see, the calculated peaks aren't accurate enough. The ones that are really important are the three on the right hand side. My question: How do I make this more accurate? UPDATE: Data is here: http://pastebin.com/KSBTRUmW For some background, what I'm trying to do is locate the

Data Augmentation Image Data Generator Keras Semantic Segmentation

南笙酒味 提交于 2019-11-28 17:35:45
I'm fitting full convolutional network on some image data for semantic segmentation using Keras. However, I'm having some problems overfitting. I don't have that much data and I want to do data augmentation. However, as I want to do pixel-wise classification, I need any augmentations like flips, rotations, and shifts to apply to both feature images and the label images. Ideally I'd like to use the Keras ImageDataGenerator for on-the-fly transformations. However, as far as I can tell, you cannot do equivalent transformations on both the feature and label data. Does anyone know if this is the

How to convert an image into character segments?

柔情痞子 提交于 2019-11-28 17:18:53
Often in the process of OCR, an image file is essentially cut into segments, and each character is recgnised as a segment each. For instance, has to be transformed to something like Also, is there any algorithm for Asian languages like Telugu readily available for this purpose? If not, how is this done for English? It can be easily done using OpenCV. Below is a sample code: import cv2 import numpy as np # Load the image img = cv2.imread('sof.png') # convert to grayscale gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # smooth the image to avoid noises gray = cv2.medianBlur(gray,5) # Apply adaptive

Algorithm to detect corners of paper sheet in photo

点点圈 提交于 2019-11-28 14:56:03
What is the best way to detect the corners of an invoice/receipt/sheet-of-paper in a photo? This is to be used for subsequent perspective correction, before OCR. My current approach has been: RGB > Gray > Canny Edge Detection with thresholding > Dilate(1) > Remove small objects(6) > clear boarder objects > pick larges blog based on Convex Area. > [corner detection - Not implemented] I can't help but think there must be a more robust 'intelligent'/statistical approach to handle this type of segmentation. I don't have a lot of training examples, but I could probably get 100 images together.

how to extract the borders of an image (OCT/retinal scan image)

女生的网名这么多〃 提交于 2019-11-28 11:43:42
I have an (OCT) image like shown below (original). As you can see, it mainly has 2 layers. I want to produce an image (shown in the 3rd picture), in which the red line indicates the top border of 1st layer, the green shows the brightest part of the 2nd layer. I have tried to simply thresholded the image. Then I can find the edges like shown in the 2nd image. But how can produce the red/green lines from these borders? PS: I am using matlab (or OpenCV). But any ideas with any languages/psudo codes are welcomed. thanks in advance Spektre Do not have too much time for this right now but you can