I have a large real time computer vision project in C with a gui that uses OpenCV 1.1's built-in HighGUI library. As others have pointed out, the OpenCV GUI library is very limited.
I'd like to make a slider bar (trackbar) GUI element like cvCreateTrackbar that can have values that go either negative or positive. OpenCV currently limits trackbars to positive integer values only. I don't need anything else fancy, just a sliderbar that can go negative.
What is the easiest way to get a slider bar that goes positive and negative?
I am on Windows XP using mingw and OpenCV 1.1. Ideally any solution should require minimum dependencies or libraries, and should play nice with Windows and mingw.
You could write a wrapper around the progress bar class that normalizes your values to the range of the progress bar. For example, if your range is -5 to 5, inclusive, add 5 to the value before sending to the progress widget. The "+5" adjusts the range from 0 to 10.
You may want to consider using a different widget as most definitions of progress measurements don't go negative. (Is your application actually making negative progress?) Also, most progress widgets allow for a positive increment, different than an absolute value. As the application runs, it adds an increment to the widget.
"That's just my opinion, I could be wrong." -- Dennis Miller.
[zGUI][1]https://github.com/zetapark/zGUI
I just uploaded a opencv gui toolkit. Please take a look..
This is solely dependent on opencv.
Event driven..
Related
I'm coding in raw C, using win32.
I want to change at runtime the position of a control (a button) to properly keep its relative position inside the parent dialog, which is resizable.
I defined both the dialog and the button via a resource script, where dimensions are in dialog base units.
To change the size at runtime I have to deal with the SetWindowPos function, which accepts values in pixels so, to maintain the original proportions, I need to convert in pixels the original distance (in dialog base units).
I've tried to use the value returned from the GetDialogBaseUnits funcion and follow the "conversion procedure" (which is, substantially, a multiplication and a division) reported in the reference page, using the MulDiv function but what I get is a wrong value...
In particular I obtain: LOWORD(GetDialogBaseUnits()) = 8 and HIWORD(GetDialogBaseUnits()) = 16 which, used in MulDiv, produce sizes in dialog base units which are exactly the half of the pixel ones (and this is wrong, in my system).
How I can properly perform this conversion?
Not with GetDialogBaseUnits().
If you have a dialog box, you can do this easily: use the MapDialogRect() function.
If you have a regular window, you'll have to do the calculations manually. I've asked a question related to it here and wrote a tool for testing possible calculations. The different calculations are close enough to be equally visually useful; don't stress too hard.
I have been trying to detect shapes in an image and also arrive at a count as to how many such shapes are present in an image, for example a plus sign. Are there any built in functions to detect such shapes ? IF any please let me know.
Thank you.
You need to find all contours in an image and then filter them.
We know that the plus sign has 12 corners. So you need to filter all contours that have 12 corners. Of course, sometimes this can give you some unwanted objects. So you can filter again those contours that have angles between 2 lines(3 corners) max 0.3 cos for example.
Take a look at squares.cpp in samples directory of OpenCV. It finds all contours with 4 corners and angles max. 0.3 cos. So pretty much all squares.
You can also take a look at the Hough transform.
One way to detect shapes is to make use of cvBlobsLib.
A library to perform binary images connected component labelling
(similar to regionprops Matlab function). It also provides functions
to manipulate, filter and extract results from the extracted blobs,
see features section for more information.
For an example, see:
https://www.youtube.com/watch?v=Y8Azb_upcIQ
An alternative is to make use of EmguCV
Emgu CV is a cross platform .Net wrapper to the OpenCV image
processing library. Allowing OpenCV functions to be called from .NET
compatible languages such as C#, VB, VC++, IronPython etc. The wrapper
can be compiled in Mono and run on Windows, Linux, Mac OS X, iPhone,
iPad and Android devices.
I need to create application, using which user can handle text in graphical interface.
User can move text objects inside parent panel/canvas or something, change fonts, change size of characters (height, width), spacing between characters and so on.
Target of application:
in the end of handling text (or while handling) user will get a position of every character, height and width of characters, distance between characters (spacing). And all those measures must be in same unit of measure (pixels, points).
So question is: What kind of framework (.NET, Silverlight, XNA, Flash, Java, HTML 5, Javascript and so on) can be used for this.
I am “sold my soul” to Microsoft (worked before only with .NET), but have some experience in Flash, HTML, Javascript, Java. So all proposals are welcome
Trying to approach with Silverlight, but only problem was with spacing (dynamically change), when trying used Glyphs it worked in some way,
only problem was: when with Glyphs spacing was changed(same for all characters), in visual spacing was different for all characters. So spacing problem is biggest for right now.
Another approach can be a handle text as a collection of characters, and calculate by myself distance between characters. But in application every user can use own custom fonts (here my knowledge not enough). So i afraid that we will need to create (draw) every character of font before can use custom fonts.
I found in Internet some applications which doing almost same thing (done in Javascript), but before start want to get more information about other possibilities.
With nobody give some advices about this,I decide to answer own question, because found already a solution how will approach to this project.
So I found a new(for me at least) version of Silverlight hav a new Property CharachterSpacing for Elements which handling with text(TextBox, Label and so on). Using this property I can change dynamically a text spacing.
Documents tell us that this property use as a unit integer which is 1000s of font's em unit. About em:
"Em size is a typographical measure that specifies the approximate width of the capital letter "M" in the Roman alphabet, measured in the units that are prevalent in a particular technology. Silverlight em sizes are given in pixels. The apparent visual size of the em size varies per font.”
So this give a very good basement for counting a real distance between charachters.
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.
I have developed a 1024 *780 resolution screen in Windows Forms, but some say that it does not fit properly at higher resolutions. Is there any way to handle this?
Is there a way to make Windows Forms applications look the same at ALL resolutions?
My recommendation is not so much to "make it look the same" on all screens, but rather to design the GUI so it scales up and down more gracefully. Layout managers, docking, and anchors are your friends in Winforms. The TableLayoutPanel is quite useful for this sort of thing. Splitters also help...
Finally, this is one of those problems that WPF sets out to solve. WPF makes extensive use of layout managers. It feels much more like Java or GTK than Winforms or even VB (old school VB).
This is the sort of thing that makes you say "there's got to be a better way."
My solution for this one time was to declare a global ScalingFactor variable that was tied to the current screen resolution. Then, the sizes of every visual element were multiplied by that factor.
So, if I designed my form for resolution A, and resolution B is 1.2x larger, the width of window A will be with * 1.2, the fonts will be fontSize * 1.2, the textbox dimensions will be dimensions * 1.2.
Not fun.
There may be 3rd party tools that you can buy and will perform this scaling.
One other thing to check before you run down any of these roads is whether it is actually the screen resolution or the dpi settings that are causing it to look bad. Usually a higher resolution will only make it look smaller, but an atypical dpi, such as when the user selects "large fonts" will wreak havoc.
You can use anchor property of item, and autoScaleMode property of form set it equals 'None'.