I am trying to create a bounding box around each character in an image. I have converted the image to binary and thresholded it but I don't understand how to create a bounding box despite reading the manual.
There are a few options for the bounding box technique, but I think you'll get a great result combining these two:
First, use the technique demonstrated here to detect a large portion of text and put a bounding rectangle around it so you crop the image to this area;
Second, experiment with the technique recently presented by OpenCV, also demonstrated here. It could be used to locate/extract individual characters on the resulting image of the first step.
I suppose you are trying to implement the OCR mechanism yourself instead of relying on great APIs such as Tesseract.
If you are looking for more information on how to do digit/text recognition, check this answer.
As said before "rudely", I encourage you to rewrite your question with more detail on what you already did. We didn't understand what you would like to do. If character recognition is what you want, have a look at this.
Related
I'm looking at some new options for displaying a percentage value as a fill in a custom shape. Consider the effect to be similar to a "progress thermometer" in a traditional dashboard UI sense.
Considerations
Goal - a graphic element showing a percentage value for a custom report.
Format - Either a full graphic (or infographic) itself, or part of a PDF via Photoshop/InDesign or even iBooks (as an excuse to use it).
Usage - I'd like the process to be programmatic, for re-use. It needs to be accurate, and I'd like the solution to be somewhat object oriented to apply to other datasets and graphical containers. This rules out hand-drawn charting.
Source data - currently a pivot table in Excel, but I can work with any other host as required.
Shape - is a custom vector shape that will originate from Illustrator/Inkscape. final format as best fits resolution and rendering of the report. I would also be interested in any other generative shape ideas (such as java/javascript).
Fill - I'd like to be able to represent the fill as both an actual percentage of total area (true up), and as a percentage of the vertical scale. I'd imagine this flexibility would also help reuse of the method as a fill value against selected object variables (height, area, whatever).
I know I'm being slightly vague in the programming languages or hosts side of things, but this gives me an opportunity to break out of the usual analytic toolchain and scope out some innovative or new solutions. I'm specifically interested in open source solutions, but I'm very keen to review other current methods you might suggest.
This might be a little open ended for you, but d3.js is very powerful. There might be some useful templates on the site, or you can build your own from the library.
If you limit yourself to shapes where the percentage can be easily converted into a new shape by varying one of the dimensions, then the display part can be covered by creating a second shape based on the first one, and filling in 100% of the second shape.
This obviously works best with simple shapes like squares, rectangles, circles, etc, where it is simple to convert "50% of the area" or "75% of the height" into manipulation of vector nodes.
However, things gets significantly more difficult if you want to support genuinely arbitrary custom shapes. One way to handle that would be to break up a complex "progress bar" into "progress pieces" (e.g. a thermometer bulb that represents 10% of total progress, then a simple bar for the remaining 90%).
As has been mentioned, D3 seems like it would meet your needs - here are some simple examples of what I think you are asking:
Changing the fill color of a distinct shape: http://jsfiddle.net/jsl6906/YCMb8/
Changing the 'fill amount' of a simple shape: http://jsfiddle.net/jsl6906/YCMb8/1/
I am new to OpenCV so I apologize if I use incorrect terminology. I am writing a program in C that finds objects in an image (in this case red building blocks) and extracts that part of the image and displays it as a new image. I have thresholded the image to remove everything but red and used cvDilate to blur the results slightly to make the object more distinct. I then used the OpenCV Contour finding and drawing functions to locate and draw the blocks.
How can I access the contour locations stored as CvSeq* and take the upper-most and lower-most contour values from a cluster of contours (there may still be some noise from other red objects) so that I can make a bounding box around it?
Thanks
Actually, you don't have to do this manually because OpenCV provides this type of functionality for you.
Look at the cvMinAreaRect2 and cvBoundingRect. Here are their examples respectively: minarea.c (has some debugging stuff, but should give you the gist of how to use it) and generalContours_demo1.cpp (in C++, but should be easy to translate).
As a side note, I would definitely suggest using the C++ API of OpenCV as it is a bit easier to understand and has more features. Also, you spend a lot less time/code worrying about memory management since the Mat class handles that for you.
Hope that helps!
i need to make a program where i have to detect the edge of a subimage (like a face in a portrait) using canny detector. then i need to filter that portion out and paste it in another background. it is like mixing 2 layers. can anybody give me any algorithm for this? or any idea about the process?
You are probably aware that the task of selecting a subimage is most known Region of Interest (ROI).
Edge detection with canny shouldn't be a problem since OpenCV implements it as cvCanny().
For what I understand you want to overlap two images. I suppose you want to add one image on top of each other? Take a look at step 2 on the first link I suggest: Adding Two Images with Different Size
If you want to BLEND them, then check these instructions. I have used them before to draw over the webcam window.
I have a sequence of images taken from a camera. The images consists of hand and surroundings. I need to remove everything except the hand.
I am new to Image processing. Would anyone help me in regard with the above Question. I am comfortable using C and Matlab.
A really simple approach if you have a stationary background and a moving hand (and quite a few images!) is simply to take the average of the set of images away from each image. If nothing else, it's a gentle introduction to Matlab.
The name of the problem you are trying to solve is "Image Segmentation". The Wikipedia page here: wiki is a good start.
If lighting consistency isn't a problem for you, I'd suggest starting with simple RGB thresholding and see how far that gets you before trying anything more complicated.
Have a look at OpenCV, a FOSS library for computer vision applications. Specifically, see the Video Surveillance module. For a walk through of background subtraction in MATLAB, see this EETimes article.
Can you specify what kind of images you have. Is the background moving or static? For a static background it is a bit straightforward. You simply need to subtract the incoming image from the background image. You can use some morphological operations to make it look better. They all depend on the quality of images that you have. If you have moving background I would suggest you go for color based segmentation. Convert the image to YCbCr then threshold appropriately. I know there are some papers available on it(However I dont have time to locate them). I suggest reading them first. Here is one link which might help you. Read the skin segmentation part.
http://www.stanford.edu/class/ee368/Project_03/Project/reports/ee368group08.pdf
background subtraction is simple to implement (estimate background as average of all frames, then subtract each frame from background and threshold resulting absolute difference) but unfortunately only works well if 1. camera has manual gain and exposure 2. lighting conditions do not change 3.background is stationary. 4. the background is visible for much longer than the foreground.
given your description i assume these are not the case - so what you can use - as already pointed out - is colour as a means of segmenting foreground from background. as it's a hand you are trying to isolate best bet is to learn the hand colour. opencv provides some means of doing this. if you want to do this yourself you just get the colour of some of the hand pixels (you would need to specify this manually for at least one frame) and convert them to HUE (which encapsulates the colour in a brightness independen way. skin colour has a very constant hue) and then make a HUE histogram. compare this to the rest of the pixels and then decided if the hue is simmilar enough.
My application presents an image that can be scaled to a certain size. I'm using the Image WPF control with the scaling method of FANT.
However, there is no documentation how this scaling algorithm works.
Can anyone reference me to the relevant link for this algorithm description?
Nir
Avery Lee of VirtualDub states that it's a box filter for downscaling and linear for upscaling. If I'm not mistaken, "box filter" here means basically that each output pixel is a "flat" average of several input pixels.
In practice, it's a lot more blurry for downscaling than GDI's cubic downscaling, so the theory about averaging sounds about right.
I know what it is, but I couldn't find much on Google either :(
http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4056711 is the appropriate paper I think; behind a pay-wall.
You don't need to understand the algorithm to use it. You should explicitly make the choice each time you create a bitmap control that is scaled whether you want it high-quality scaled or low quality scaled.