I need to compare two images together if any change happened mouse point to it
how to use mouse in opencv using visual c++
but I can't understnd the function can any one simplefied it to me
thnx
there is an sample called "LK demo" in opencv\samples
in that sample there is cvSetMouseCallback calls on_mouse function
i think it will be a good start for you
Related
I searched a lot about finding a way to make me move the desktop cursor using OpenCV but all I found is some demos for people who already did it.
what I know is that the function setMouseCallback gives me the coordinates of the mouse and more but i need to give the mouse some positions to move into it.
So can anybody tell me how can i do it using OpenCV C++ ?
You cannot do this in OpenCV. OpenCV is a computer vision library focused around analysing and manipulating images and although it provides simple user interface (UI) elements do not get fooled into thinking it is a powerful user interaction tool.
Now, if you want to move the cursor in windows you can use SetCursorPos which I believe works on most versions:
SetCursorPos(X,Y)
e.g.
SetCursorPos(100, 200)
I'm trying to develop a simplistic 2D browser game with dart.
The player is drawn from a png-image represented by an ImageElement in dart.
I want the player-image to turn towards the mousepointer, but cant find how to rotate an image in dart.
Any suggestions as to how this might be done?
I would highly recommend using the StageXL library for this (https://pub.dartlang.org/packages/stagexl). It's basically a recreation of the Flash APIs for Dart. It makes doing that sort of thing very easy, and it's often used to create Dart games.
I ended up using multiple images for the 8 general directions the player can move and set them accordingly.
I am developing an interactive CD most of my life I wrote console applications writing something mostly graphical is akward for me.
So here is my approach :
I am drawing on the canavas using shapes and images the left and top position are stored in a file. Is there any easier approach ? I thought using shapes objects would simplify my work what do you guys think ?
Any examples are welcome.
If you consider this question subjective please vote for closing.
The proper way is to write an OnPaint handler (that is, listening to the WM_PAINT message) and drawing using the GDI.
Here are a couple of simple examples:
Moving triangles
Bouncing ball
Drawing by moving controls is very awkward.
Since you didn't specify a any version, I assume you're not wasting your time with an ancient Delphi, so maybe you should also take a look at FireMonkey.
That also opens the door to having your interactive stuff work on other platforms..
I recommend the Delphi GDI+ Library which I have used with success. It's a wrapper around GDI+ which takes alot of the pain out of it.
If my designer gives me a 960x640px image of what the screen should look like, as well as all of the individual elements as images or text, is there a way to lay out the images and text on the iPhone/iPad screen without doing it manually through code? The way I'm doing it now is a series of trial and error, trying to guess the position of each element.
By the way, the types of layouts I'm trying to do are simple static layouts for stuff like Menus and High Scores lists, etc.
You should try one of the editing tools: LevelHelper, CocoShop and CocosBuilder. The problem will be the output format, make sure that not only the editing part works to your specification but that you can actually use just the snippet of code you need to plug it into your code.
Do you have an image-editing software like Photoshop or GIMP? How about opening the 960x640px image with any such software, then hovering your mouse over the center of each element for its coordinates, and then finally pumping these values into your code?
In my opinion, this is at least better and way faster than trial and error:)
If you want to measure position of graphic elements. You can try a commercial called xscope. The trail version can be downloaded form their official website. It is the best tool I ever seen to measure distance, color(like, it can copy color measured directly to [UIColor ...] format), etc. If you want something freeware, I would like to recommend markman, which is a Chinese software, it's built on adobe air. All elements/button are graphic, so you don't need to read chinese to use it..
You can try to use some open source editor and write your exporter. For example I am using blender as a level editor for the game I am working on. It has a nice python API that can be used to export all the information you need.
Is there some simple component that could display PNG 32-bit images and alpha-blend it to another image on mouse enter and on mouse leave? Or even just a simple image that can load 32-bit PNG and additionally would have Alpha parameter...
I suppose I could use some skin library (alphacontrols?) or some graphics library, but for some simple purely visual effects that would be quite an overkill and I can't seem to find a simple one that does it for me and would work on Glass surface as well...
It is not quite a component, but here is a link to a good article on how to do it yourself. Its just a few lines of code:
http://melander.dk/articles/alphasplash/
The basic TImage is capable of displaying a PNG image and alpha-blend-it to whatever is behind it. You just need to add the "pngimage" unit to the uses clause of your form. You didn't mention the version of Delphi you're on: Delphi 2010 has this unit, but I have no idea with what version of Delphi they started shipping it. For Delphi 7 I know for sure you'll need to find the open source "pngimage".
If you need to do this when the user moves in and out of your control, consider caching the state images in bitmaps: it will be faster at runtime and you can use a single TImage that shows the current image, you don't need two overlapping TIMage controls.