You're not looking for edges (=borders between extended areas of high and low gray value), you're looking for ridges (thin lines darker or brighter than their neighborhood), so edge filters might not be ideal: An edge filter will give you two flanks (one on each side of the line) and a low response in the middle of the line:
ADD: If've been asked to explain ...
I suggest the following steps:
Find a threshold to separate the foreground from the background.
For each blob in the binary image (one zebra stripe), for each x, find the weighted center (by pixel intensity) in y direction.
Possibly, smooth the y values, to remove noise.
Connect the (x,y) points by fitting some kind of curve. This article might help you. ...
This is an extremely difficult task, one which is a very active line of research. I've managed to find a semi-recent paper on the subject. I won't go into the details, but here's a few things that this paper found that can be used.
Textures: If you see a given texture, they can help you figure out how far something is away. The wood texture here would be ...
This is what your code produces (using colormap(hot) with white boundaries that are obtained from IM2):
I think the shadows are nicely treated, why are you thinking that your code doesn't notice between shadow to grapes?
This is the code used for producing this image
[B,L] = bwboundaries(bw,'noholes'); % fill any holes, so that regionprops ...
1) Yes, your solution is correct.
2) If you assume that all a priori probabilities are equal, then the boundaries for AWGN is always the middle points between the possible values of X. In this case, then, the decision boundaries are at 75 and 175.
I believe that this rule (decision boundary at the middle points) can be generalised to applying to any noise ...
Sounds like you want to denoise and preserve edges. Have you considered nonlocal means? There's some GPL'd C++ code along with a brief writeup of the algorithm by the original authors here: http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/
One caveat, nonlocal means is very slow and the output can be sensitive to the implementation you have. You ...
I do not know about many segmentation techniques, but I have been dealing with structures that offer a "choice" of segmentation pieces that can be further examined to produce a satisfying segmentation.
Hopefully somebody else can write about some different state-of-the-art segmentation method that I don't know much about.
A small introduction as to why it ...
Be careful, a median filter cannot be expressed as a convolution, and thus is not considered a kernel in this respect. This is because the median filter is based on order statistics of an image patch, and the resulting pixel at the output of a median filter is not a linear combination of other pixels within a patch.
Otherwise, you are right, kernels are ...
It can be a little confusing at times, and the terms are not completely independent.
In detection, you are simply detection the presence of something. For example, you might design an algorithm to detect beach-balls from pictures of a beach. You would feed an image into your algorithm, and it will spit out an answer 'yes', if there was a beach ...
So one good step to enhance the vein-like structures is coherence enhancing diffusion:
Weickert, Joachim. "Coherence-enhancing diffusion filtering." International Journal of Computer Vision 31.2-3 (1999): 111-127.
So I first apply this algorithm to your image, aggressively. The next step is to identify the curvilinear structures, which would in this case ...
$YUV$ (or $YCbCr$) is like $HSV$, but in different coordinates. (The difference between $YUV$ and $YCbCr$ is marginal - mostly related to exact formulas).
The $V$ component is the same. $(S,H)$ can be thought of as polar coordinates, and $U,V$ as cartesian. $H$ is the angle, $S$ is the radius. A rough conversion would be:
$ U = S *cos(H) $
$ V = S * sin(...
Following on from the above excellent answer, here is how to do it in python using scikit funcitons.
from skimage.feature import hessian_matrix, hessian_matrix_eigvals
#assume you have an image img
hxx, hxy, hyy = hessian_matrix(img, sigma=3)
i1, i2 = hessian_matrix_eigvals(hxx, hxy, hyy)
#i2 is the variable you want.
#Visualise the result
When using Canny edge detection (in Halcon), with alpha being 1, and the low threshold 8 and the high threshold 13 (on a scale of 1-255), I get the following result:
With tweaking of the parameters, the result you got from Canny can be much more improved.
Using this image, you can skip the short edges to remove the noise, and connect the long edges for the ...
As an addendum to Penelope's answer, two popular families (and trendy) of algorithms.
A very popular family of algorithms called Superpixels is very trendy right now (there are even some Superpixel sessions in CV conferences). Superpixels are a lot like over-segmentation (like what watershed gives you), so some post-processing is required.
Alas, optical flow is a difficult problem too ;-)
Well, to be more constructive, here are a few algorithms that should be worth trying (or have been tried on this particular sequence) :
re-train your bags of features on a databse of vehicles more representative (in size and orientation) to your actual problem in order to obtain better results
use the fact ...
Use the haartraining methods of opencv according to this tutorial http://note.sonots.com/SciSoftware/haartraining.html -- this should give the best results, but I haven't worked with haartraining myself so far...
I would suggest to use methods of "markerless tracking" of the individual tiles of the board. You can implement this ...
You need to work with different color space. Try YCbCr for instance
oimg = imread('http://i.stack.imgur.com/aYhrS.png');
img = rgb2ycbcr(oimg); % conver RGB to YCbCr color space
msk = img(:,:,3)>130; % apply threshold on Cr channel to get segmentation mask
I picked up 130 as arbitrary threshold, you might need to adjust it a bit.
Showing the input ...
Just an idea with no guarantee of success:
isolate the red blobs (e.g. mark them as white, the rest of the image as black)
perform a distance transform for the white blobs (every pixel indicates the distance to the nearest black pixel)
perform a non-maxima-suppression (ideally only the centers of the circles remain)
deal with non ideal conditions (filter ...
I asked Google again for you, but I did manage to find some hits in the end. There is already a very good question on stackoverflow concerning the exact same thing you are interested in.
There is a very nice explanation of split-and-merge provided in one of the answers, as well as simplified pseudocode.
The other answer provides a link to the ...
Other than commercial barcode reading algorithms (many of which fail to read challenging codes), I would like to direct you to this paper which is one of the best academic works in that field in my opinion:
Gallo, Manduchi: Reading Challenging Barcodes with Cameras.
Here is a more recent version:
Gallo, Manduchi: Reading 1D Barcodes with Mobile Phones ...
This code work fine for me. You try
RGB = imread('Image/input.png');
GRAY = rgb2gray(RGB);
threshold = graythresh(GRAY);
originalImage = im2bw(GRAY, threshold);
originalImage = bwareaopen(originalImage,250);
se = strel('disk', 10); %# structuring element
closeBW = imclose(originalImage,se);
It can be done very easily with the scikit-learn. Examples are easy to find on their website, i.e. here. In my opinion it is the best way to go.
Modified code example from the above link:
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets.samples_generator import make_blobs
1) Normalize your image to range $[0,255]$.
2) Select a threshold and threshold the image. For your image, what worked is: $\tau=[140-150]$.
3) Compute a Euclidean distance transform.
4) Apply watersheds segmentation.
If I apply this procedure, here is what I get:
Not perfect, but maybe a good start. The result looks similar to performing a Voronoi ...
I am currently working on CBIR using Component Trees, which should be a relatively new idea. Some expected advantages of using Component Trees to describe images would be:
The Component Tree representation of an image would not depend so much on the deformations (even projective) to the image
Examining different levels of the tree would allow comparisons ...
MSER (Maximally stable extremal regions) are regions, not points. And they're invariant to affine transformation. But it's not a segmentation method, strictly speaking
Informally speaking, the idea is to find blobs at various thresholds, then select the blobs that have the least change in shape/area over a range of thresholds. These regions should be stable ...
Which method are you using to detect the lines? Have you tried experimenting with LSD?
Here are the results of a quick test I did using LSD:
In this first image I have displayed only the vertical line segments with an angle between 75 and 105 degrees and the length greater than $0.1 * height$ of the image:
The second image are the results with the same ...
Okay I found some ideas about using Fourier Transforms in Object Recognition. What I am unable to understand is however, its downsides. Why was the method discarded.
For those who are interested in reading about how Fourier Transforms were applied in Object Recognition , look for Fourier Mellin Transforms.
The Fourier-Mellin transform is a useful ...
I think the open-source command-line program potrace, might do what you want. It converts bitmaps to bezier curves and has a bunch of options allowing you to trade off smoothness and accuracy.
The open-source Inkscape vector (svg) editor has potrace built in (under the Path->Trace Bitmap menu option.) The result of applying your example in Inkscape, (I ...
You could apply a 2d FFT. You will get a frequency spectrum as z values on a 2d plane:
← That's log(abs(fftshift(fft2(image))))) where image is from the question, but with white borders trimmed
From the z values you can determine the highest peak and calculate its position on the 2d plane. With some geometric calculation, you can derive wavelength, ...