Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there any library for converting a raster image to a vector one limiting the number of sampled colours to a specific set? Something like what is done in VectorMagic but giving a subset of colours to be used.
Imagetracer is a free and open source (Public Domain) library and application which might be useful. Disclaimer: I made these.
If you need a command line application, I recommend ImageTracer.jar from
https://github.com/jankovicsandras/imagetracerjava
with options like these
java -jar ImageTracer.jar input.png outfilename output.svg numberofcolors 4
to limit the number of colors to 4. If you call the library from a Java program, you can use custom palette, and there are many other options.
You can use the JavaScript version from the browser or with Node.js:
https://github.com/jankovicsandras/imagetracerjs
There is the opensource library/program potrace which performs a fine vectorization. The thing is it first converts the input image into a luminensce one, and then binarize it. This step is optional, made by a separate program, so you can use potrace but in a different manner, by constructing yourself several versions of binarized images. I think VectorMagic builds its contours based on the gradient/laplacian of the input image, that's why you cannot impose any set of colours.
If you have a subset of colours to be used as input, I advise you to folow the following algorithm:
for each colour of the input subset of colours, find the subspace of the colour space which is "nearest" from the selected colour than from any other colour. Something like an algorithm computing the Voronoi partition of the input subset would do the job quite well at once; use for example qhull for that.
for each subspace, binarize the input image, drawing every pixel white if inside the subspace and black otherwise. Then apply potrace's or VectorMagic's vectorization on it.
At the end, you will get a set of contours. Maybe the contours would not match exactly, but there would be sufficiently close to let you simplify them and delete properly doublons of contours.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to find the algorithm or even the general idea behind some of the effects used in Photoshop. Specifically, the palette knife effect that simplifies the colors of an image. For instance, the image bellow:
turns into something like this:
I want for each group of pixels that have similar color, to turn into a simple block of one or two colors (in real time) as happens in Photoshop. Any idea of a method to do this is appreciated.
Following tucuxi's suggestion, I could run a classification algorithm like kNN to pick K main colors for each image (frame in the video) and then change each pixel's color the the closest one from the k representatives. I am going to put the code here, and I appreciate any suggestions for improving it.
Since you want to choose representative colors, you can proceed as follows:
choose K colors from among N total present in the image
for each pixel in the image, replace it with its nearest color within the K chosen
To achieve step 1, you can run a k-nearest-neighbors over the actual color-space. In an WxH image, you have WxH pixels, each with a color. You choose K random colors to act as centroids, add the closest pixels to each, and after a while, you finish up with K different colors that more-or-less represent the most important colors of the image (in terms of being not too far from all others). Note that this is only one possible clustering algorithm - I am sure a lot of literature exists on alteratives and their relative merits.
Step 2 is comparatively much easier. For each original pixel, calculate distance to each of the K chosen colors, and replace it by the closest one.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
please help me.
I'm looking for a simple algorithm that its input is a single image and that's it. The output will be a depth map of the image with colors of pixels according to if they are near or far from the camera.
I am looking for a simple solution without Machine Learning, 3D model, sterioscopic input or user input help. Only a single image.
thank you
What you are asking is in general an ill posed problem.
However, recent work with deep-networks have shown that a depth map can be predicted from a single image.
Here's one such paper: Depth Map Prediction from a Single Image
using a Multi-Scale Deep Network.
From the abstract:
Predicting depth is an essential component in understanding the 3D
geometry of a scene. While for stereo images local correspondence
suffices for estimation, finding depth relations from a single image
is less straightforward, requiring integration of both global and
local information from various cues. Moreover, the task is inherently
ambiguous, with a large source of uncertainty coming from the overall
scale. In this paper, we present a new method that addresses this task
by employing two deep network stacks: one that makes a coarse global
prediction based on the entire image, and another that refines this
prediction locally. We also apply a scale-invariant error to help
measure depth relations rather than scale. By leveraging the raw
datasets as large sources of training data, our method achieves
state-of-the-art results on both NYU Depth and KITTI, and matches
detailed depth boundaries without the need for superpixelation.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a project which involves detecting the red blood cells in the blood. RBCs in the blood are never perfectly circular (usually almost eliptical) and they often overlap.
I've searched and found a number of algorithms, but most work for circles only. However, in my case it needs to work for blood from patients with sickle cell disease, where the RBCs are elongated or sickle-shaped. For reference here is an example source image.
Can you suggest an algorithm or approach to solve this problem?
Any help would be greatly appreciated.
As mentioned in the comments, this question is really too broad to answer completely. However, I can give you some pointers in how to address this.
For starters, get yourself the MATLAB Image Processing toolbox.
"Identify red blood cells" is a deceptively simple-sounding task. The first step with any project like this is to figure out what exactly you want to achieve, then start breaking it down into steps of how you will achieve that. Finally, there is the experimental-developmental stage where you try and implement your plan (realise what is wrong with it, then try again).
Cell counting normally uses circularity to identify cells, but that's not possible here because you state you want to identify sickle cells. The other main characteristics distinguishing RBCs from other cells is the colour and size. The colour is more absolute, so start with that. Then think about size. This is a good tutorial on the process of identifying cells although it is in Python the principle is the same.
So we have:
Apply a filter to your image, either isolating the red channel (RGB) or something more complex. Make it monochrome (we don't need colour data).
Smooth the image (e.g. gaussian filter) to reduce the noise and artefacts
Find regional maxima which are (hopefully!) in the center of cells
Label the regional maxima (this should give you the number of cells)
Watershed to find the whole cells an measure size
Hopefully that is enough to get you started!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Let's say I have a very simple image with a few colours (white, black, grey). And I have a set of tiny images (lots of them). Is there any library that can help me rebuild the big image using all of the tiny images as building blocks? Like a mosaic.
Here's an example: http://d.pr/i/LJ0Z
P.S. I've tried to google a solution, but it seems I can't create correct search query because of my bad english. I only get software solutions for creating mosaics.
Just posting a solution to my problem here in case anyone will need in the future.
Let's say you have a simple image with a few colours. You need to re-create it with a set of smaller images (like a mosaic).
Split your image into cells (4x4, 8x8 or any other number) and assign corresponding colour for each cells (in other words "pixelate" your image), create array of cells for each color you have.
Implement listing #4 for Maximal Rectangle Problem from this article: http://www.drdobbs.com/database/the-maximal-rectangle-problem/184410529 (huge thanks to David Vandevoorde for such a great explanation!)
Now, for each small image you have (pieces of mosaic), determine its size as a rectangle. Then, using rectangle packing algorithm of your choice fill the max rectangles with these small images (I've been using this one for C#: http://kossovsky.net/index.php/2009/07/cshar-rectangle-packing/ again, huge thanks to the author for sharing!)
That's it. It's not very fast, but it gets the job done.
this search turns up various results:
andreamosaic
pixisnap
etc.
adding "python library" found osaic. repeat for whatever language you are using...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a web site that allows users to upload images of cars and I would like to put a privacy filter in place to detect registration plates on the vehicle and blur them.
The blurring is not a problem but is there a library or component (open source preferred) that will help with finding a licence within a photo?
Caveats;
I know nothing is perfect and image recognition of this type will provide false positive and negatives.
I appreciate that we could ask the user to select the area to blur and we will do this as well, but the question is specifically about finding that data programmatically; so answers such as 'get a person to check every image' is not helpful.
This software method is called 'Automatic Number Plate Recognition' in the UK but I cannot see any implementations of it as libraries.
Any language is great although .Net is preferred.
EDIT: I wrote a Python script for this.
As your objective is blurring (for privacy protection), you basically need a high recall detector as a first step. Here's how to go about doing this. The included code hints use OpenCV with Python.
Convert to Grayscale.
Apply Gaussian Blur.
img = cv2.imread('input.jpg',1)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_gray = cv2.GaussianBlur(img_gray, (5,5), 0)
Let the input image be the following.
Apply Sobel Filter to detect vertical edges.
Threshold the resultant image using strict threshold or OTSU's binarization.
cv2.Sobel(image, -1, 1, 0)
cv2.threshold()
Apply a Morphological Closing operation using suitable structuring element. (I used 16x4 as structuring element)
se = cv2.getStructuringElement(cv2.MORPH_RECT,(16,4))
cv2.morphologyEx(image, cv2.MORPH_CLOSE, se)
Resultant Image after Step 5.
Find external contours of this image.
cv2.findContours(image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
For each contour, find the minAreaRect() bounding it.
Select rectangles based on aspect ratio, minimum and maximum area, and angle with the horizontal. (I used 2.2 <= Aspect Ratio <= 8, 500 <= Area <=15000, and angle <= 45 degrees)
All minAreaRect()s are shown in orange and the one which satisfies our criteria is in green.
There may be false positives after this step, to filter it, use edge density. Edge Density is defined as the number of white pixels/total number of pixels in a rectangle. Set a threshold for edge density. (I used 0.5)
Blur the detected regions.
You can apply other filters you deem suitable to increase recall and precision. The detection can also be trained using HOG+SVM to increase precision.
I coded a C# version based on JAVA ANPR, but I changed the awt library functions with OpenCV.
You can check it at http://anprmx.codeplex.com
There is a new, open source library on GitHub that does ANPR for US and European plates. It looks pretty accurate and it should do exactly what you need (recognize the plate regions). Here is the GitHub project:
https://github.com/openalpr/openalpr
I came across this one that is written in java javaANPR, I am looking for a c# library as well.
I would like a system where I can point a video camera at some sailing boats, all of which have large, identifiable numbers on them, and have it identify the boats and send a tweet when they sail past a video camera.
I have done some googling about this a couple of months ago. There are quite a few papers about this topic, but I never found any concrete open-source implementation. There are a lot of commercial implementations though, but none of them with a price quote, so they're probably pretty expensive.
try this Simple Automatic Number Plate Recognition System
http://opos.codeplex.com/
Open source and written with C#
Have a look at Java ANPR. Free license plate recognition...
Yes I use gocr at http://jocr.sourceforge.net/ its a commandline application which you could execute from your application. I use it in a couple of my applications.
High performance ANPR Library - http://www.dtksoft.com/dtkanpr.php. This is commercial, but they provide trial key.
http://licenseplate.sourceforge.net Python (I have not tested it)
It maybe work looking at Character recoqnition software as there are many libraries out there that perform the same thing. I reading an image and storing it. Micrsoft office is able to read tiff files and return alphanumerics