My goal is to calculate the blurriness of an image in this way. Basically it firstly converts an image to grayscale and then convolve it with laplacian kernel, and then take a variance of it.
I currently choose GPUImage for doing this job because it has grayscale filter and convolution filter and it's easy to implement and use. I chose it over other options like CoreImage and Accelerate because they don't explicitly have grayscale filter (actually I would prefer Accelerate since it seems fastest one of the three, but I don't know how to make it happen.), and I chose it over OpenCV because it seems a pain to have C++ code to work with Swift, and it's the slowest one of all frameworks above.
But now I found that I couldn't find a way to calculate the variance of GPUImage.
Anyone knows how to do it?
And considering my end goal, what framework is the best choice for me?
If anyone knows how to achieve this task using Accelerate that would be awesome too!
Related
Is there any way to find Moire Patter in an image I can use in my iOS app using Swift and maybe OpenCV?
Any help would be appreciated.
You can find Moire Pattern in Fourier transformed image.
If you want to remove it, apply median filter and inverse Fourier transform.
See this paper.
If you are looking for a cutting edge solution, then finding the Fourier transform is not the solution for you. It will eat up a lot of computing resources on the mobile as well. Instead, let the deep learning find the Fourier transform for you.
I have tried both the solutions on iOS:
Thresholding on the frequencies after the transform
Convolutional Neural Network based classifier
You will be surprised at the results using CNN.
Refer to this paper, https://ieeexplore.ieee.org/document/8628746/
I'm trying to detect shapes written on a whiteboard with a black/blue/red/green marker. The shapes can be circles, rectangles or triangles. The image can be found at the bottom of this post.
I'm using OpenCV as the framework for the image recognition.
My first task is to research and list the different strategies that could be used for the detection. So far I have found the following:
1) Grayscale, Blur, Canny Edge, Contour detection, and then some logic to determine if the contours detected are shapes?
2) Haar training with different features for shapes
3) SVM classification
4) Grayscale, Blur, Canny Edge, Hough transformation and some sort of color segmentation?
Are there any other strategies that I have missed? Any newer articles or tested approaches? How would you do it?
One of the test pictures: https://drive.google.com/file/d/0B6Fm7aj1SzBlZWJFZm04czlmWWc/view?usp=sharing
UPDATE:
The first strategy seems to work the best, but is far from perfect. Issues arise when boxes are not closed, or when the whiteboard has a lot of noise. Haar training does not seems very effective because of the simple shapes to detect without many specific features. I have not tried CNN yet, but it seems most appropriate to image classification, and not so much to detect shapes in a larger image (but I'm not sure)
I think that the first option should work. You can use fourier descriptors in order to classify the segmented shapes.
http://www.isy.liu.se/cvl/edu/TSBB08/lectures/DBgrkX1.pdf
Also, maybe you can find something useful here:
http://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/
If you want to try a more challenging but modern approach, consider deep learning approach (I would start with CNN). There are many implementations available on the internet. Although it is probably an overkill for this specific project, it might help you in the future...
I'm new in the texture recognition field, and I would like to know which are the possible ways to approach a texture problem in opencv.
I need to identify the texture within a region in the pic, and tell if it is uniform, homogeneous in the whole area, or not.
More in depth, I need to be able to tell if a possible fallen person is a person (with many different kind of textures) or something wrong like a pillow, or a blanket.
Could anyone suggest a solution, please?
Is there some already made opencv code to adapt?
Thanks in advance!
Why don't use haralick features? I other words they are called texture features. The base idea is to compute coocurence matrix from given gray-scaled image on base which the haralick features are computed. You can pick between different features like contrast, correlation, entropy etc. which can describe your texture. I guess for the same texture given feature should have the same (similar) value, so that might be the way for distinguishing textures.
Here some links can be helpful:
Coocurence matrix tutorial
Haralik features summary
Coocurence matrix in scikit image
So far as I know, there is no implementation of haralick features in opencv, but you can use python with scikit-image (of course you can use opencv with python if you don't mind using something different than c++).
I like to know what is the best way of classifying texture images that have extreme randomness but contains slight repeated patterns. I know nothing in this area and any link that points to good resources are welcome.
I want to separating two images that contain 8 bit grayscale textures that have visually no image but i suppose algorithms are able to detect similarities and differences.
basically you need to extract texture features. Some of the texture features you should try using are
1. GLCM features (matlab implementation : http://www.mathworks.com/matlabcentral/fileexchange/22187-glcm-texture-features)
2. LBP (local binary pattern)
3. Gabor features (I have an implementation for this, pls tell me if u want these)
4. Wavelet features
Another excellent source to solution to your problem
http://academiccommons.columbia.edu/download/fedora_content/download/ac:128294/CONTENT/81.pdf
I am trying to forward Fast Fourier Transfer an Image and then backward Fast Fourier Transfer it. I am using the library from http://www.fftw.org/. The thing is that I have stored the RGB values in a one dimensional array in the listed order. The way I think would work is to allocate arrays for each of the colors and do a separate FFT for each array. Like this:
fftw_plan_dft_2d(imageWidth, imageHeight, pixelColor, fft_result, FFTW_FORWARD,
FFTW_ESTIMATE)
I don't know much about FFT but to me it doesn't seem like an ideal way to do it. Can someone tell me if there is a better way to FFT all the pixelcolors from an Image with the library from fftw.org?
Thanks.
No sure what an fft of a colour image would mean.
Presumably you want to look at structure in each colour or more common - just make a greyscale (intensity) image and work on that