I am using Delphi and Mitov VideoLab 7.0.
I have a CMOS camera that is hooked to a microscope. When I take pictures I need to go to a white spot and correct the white balance. For that I need to use the cameras own control panel. This panel also comes with some other stuff like setting resolution.
Using Delphi XE3 and Videolab 7.
How can I show the camera controls in my Delphi app?
For that I need to use the cameras own control panel.
You don't explain if that control panel is camera's or Videlab's.
I will assume you refer that CP is generated by camera's software (driver).
So, here is the answer:
If you are lucky and the producer offers also an OCX you can import it in Delphi as then easily access the camera.
Check driver's folder. See if there are any OCX files there
Check producer's the web site
Ask the producer (and hope it will answer)
If there are no OCX files you might still be able to access the camera BUT won't be easy. You can use the camera's driver (DLL) files. But that involves some hacking.
Hi everybody I have solved my issue the following way:
Instead of using Mitov videoLab (btw its a great plug in) I used Vframes found here on StackOverflow:
Delphi Webcam Simple Program
I used this to show my camera controls
Cam.ShowProperty;
where Cam: TVideoImage
Moreover the Vframes lets me show the camera directly into TImage canvas so its very easy to capture and save to disk or database.
adotable1.FieldByName('pic').Assign(Image1.Picture.Bitmap);
Where pic is defined as image (im using MSSql Express).
To show the image back I use DBImage linked to the pic field..works like a charm.
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)
A few weeks ago I saw on the internet that you could display a small dialog/ menu with a few properties of the camera. In this menu the user can change the contrast, brightness...but I can not find it anymore. Does somebody know the code to get this dialog?
Thank you in advance!
Set the property CV_CAP_PROP_SETTINGS with any value.
cv::VideoCapture cap(0);
cap.set(CV_CAP_PROP_SETTINGS, 0); //opens camera properties dialog
OpenCV doesn't offer this functionality. Different camera manufacturers have different API's for accessing and changing camera parameters. There is no standard way to do this. So, you can try to access your camera settings using its API and then you can write your own GUI dialog window (for example, using QT library) to view/change the parameters.
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.
I was trying to convert a GIF image (Ajax waiting like):
to AVI that will be used with TAnimate control (win32 animation control).
I have tried a few tools, but the problem is that the output AVI is either not suitable for the Animation control or not transparent.
Notes:
I don't use windows XP Themes manifest (D5).
the Common Avi's are transparent even if my program is not themed.
Using the GIF itself to show animation is not an option.
Do you know any tool that can help me with this conversion?
EDIT:
I have tried using ImageMagic with ffmpeg as described here. but I can't seem to set ffmpeg to encode to msrle.
Jasc Animation Shop is able to directly read an animated GIF and write out a compressed AVI. This is an old program that appears to be no longer offered by Corel (who acquired Jasc), but you may still be able to find the free trial version for example.
You could try the TGIFImage component (written for Delphi 5), which claims not only to support Animated GIFs, but also Transparency, as well as a means of converting a GIF to an AVI (and vice-versa).
Whether it does all that or not I cannot say as I haven't personally tested it. Like TLama mentioned in the OP comments above, I use my own means of playing each frame in an animated fashion (only mine uses a RES file and a TImage, where each frame is stored as a PNG for full semi-transparency support).
Many commercial tools do this conversion, including Corel Photo Paint, and others. A free trial is available for Corel Photo Paint, which comes included in the Corel Draw package. (Warning: It's huge, and expensive.) I don't think the transparency will be solved any more by corel photo paint's conversion than by anybody else.
Typing some words into Google, also reveals that DSPack from ProgDigy might help you.
The last time I did this, I abandoned the attempt to convert GIF transparency into AVI-with-transparency, because no AVI-encoding tool that I could find would preserve transparency. Thus the solution of leaving it as a gif, and putting a new control into your app (as LaKraven suggests) may be superior in the end, to fighting it.
I would suggest using GDIPlus native image renderer which can easily handle animated GIFs as well as many other image types, including multi-frame TIFFs (no MNG so far). I was able to find an example component which animates TImage instance:
http://www.progdigy.com/forums/viewtopic.php?p=13156
Please note I am aware that you are looking for a solution to AVI transparency, this is just an alternative way of presenting user with a "progress", which seems to be more lightweight (no dependency on windows media playback facilities) and flexible (such animation controller can be used on any image).
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.