g0nzo

Members
  • Content count

    194
  • Joined

  • Last visited

Community Reputation

204 Neutral

About g0nzo

  • Rank
    Member
  1. Thanks! This is amazing, they actually managed to do tracking and 3D rendering on device almost exactly the same as mine (WM 5.0, 200 MHz processor) at 12fps. Unfortunately they haven't released DSVideoCE package responsible for capturing camera video stream yet and they use their own fixed-point math library (not sure if it's publicly available). At least now I know it's possible :) [Edited by - g0nzo on February 21, 2007 2:08:47 AM]
  2. Hi, does anyone know if it's possible to have some low-level access to a camera on WM 5.0 devices? I need access to a video stream - I don't want to save it to a file, I just need to have access to a current frame. There's a Camera API in WM 5.0, but it doesn't allow that. Maybe it's possible with mobile version of DirectShow (if there is one)? I could probably achieve something similar by taking still photos to a file and read them from a file to memory, but I guess I could measure its performance in seconds per frame. BTW. I'm trying to create a camera based tracker library, so it would return dx and dy (position change) values using camera as an input device. It works fine on desktop pc as there's OpenCV library that takes care of almost everything, but the whole idea was to have it working on mobile devices. Thanks in advance for any ideas.
  3. It almost feels like IRC :) Actually I have only 2 points - previous and current and calculate difference of their position. The app works fine with the boolean flag and it's impossible to derive from a struct in C# (or is it?), so I'll leave it as it for now. Thanks again!
  4. Thanks. I already added boolean value to my main class to indicate whether there's already a point or not and it works. I was just wondering, if there's a simpler solution (without adding new members) - like assigning null value for classes, but for structs.
  5. Thanks, but PointF.Empty indicates that the point has value x=0 and y=0. Thus it doesn't indicate that its values are undefined (empty), like in case of null value, but only that they are 0.
  6. Hi, I'm trying to rewrite part of the code that uses a custom class to represent a point to use PointF struct. However I need to calculate this point and if anything goes wrong, null value is assigned to the point object. This way in the next iteration I know that there's no previous point (it's null). However it's impossible to assign null to struct: Cannot convert null to 'System.Drawing.PointF' because it is a value type I could create additional boolean value or just create a class that would be almost exactly the same as PointF struct, but is there some easier way? PointF has IsEmpty property, but it's read-only and it returns true for x=y=0, which is not what I need. Thanks in advance
  7. Quote: I'm assuming that you have to close the CvCapture in the thread - there's no chance you could create it outside and pass it in, to close it outside the thread, or wrap it in a finalizable object? I'm trying to create a library that will return position change (dx and dy) using a camera as an input, so passing a camera object (CVCapture) is not really an option. Right now I'm using SharperCV (image processing) library, which is a C# wrapper over OpenCV library written in C. I have SharperCV source code and it looks like there's a CVCapture destructor defined that calls Close() method, so in theory it should close itself automatically. I'm not sure why it doesn't work. Quote: As an aside, instead of using the cancel property, you could use the WorkerSupportsCancellation/CancelAsync/CancellationPending properties/methods on the BackgroundWorker. Thanks, I didn't noticed that. The while loop with Application.DoEvents() seems to do the trick, however I'm not using CVCapture in the loop right now, so I'll have to check if it works, when I'll actually put some code in the Tracker.Run loop :) Thank you very much!
  8. Thanks anyway. You can still help, as it turned out that the app doesn't work :) Here's the code I've added to the main form: protected override void OnClosed(EventArgs e) { tracker.Cancel = true; base.OnClosed(e); } The strange thing is that when I set a breakpoint in OnClosed method, then when quitting the app, it breaks on this breakpoint and then breaks on another breakpoint set on the cap.Close(); line (see the first post) and the app quits fine. But, when I don't set a breakpoint in OnClosed method or just run the app without debugging, the cap.Close(); line is not executed and the app is still running after quitting and I have to close it manually through Task Manager. I have no idea why it works like that. Maybe it has something to do with Thread.Sleep()? As I've previously said I'm new to threading, so it's really a mystery to me. [EDIT] It looks like it has something to do with Thread.Sleep, because I've changed 1000ms to 10ms and now it seems to execute cap.Close() everytime. But I still have no idea why it works like that and how to make it work correctly, so it will work with any value. [Edited by - g0nzo on February 16, 2007 9:33:56 AM]
  9. Once again I've asked too soon. RunWorkerCompleted event is not triggered when app is quitting, so the "cancel" was never set to true. I've overridden OnClose event handler in the main form to set "cancel" to true and it looks like it works. EDIT: Well, it doesn't work :) [Edited by - g0nzo on February 16, 2007 9:08:28 AM]
  10. Hi! It's my first attempt to threading. I've got class Tracker that's constantly running in the background using BackgroundWorker. When it is cancelled I need to free a resource, but I've got problems with that. Here's my code: class Tracker { public void Run(object data) { try { cancel = false; BackgroundWorker bgWorker = null; if (data != null) { bgWorker = (BackgroundWorker)data; } cap = new CvCapture(-1, false); for (; ; ) { if (cancel == true) break; Thread.Sleep(1000); bgWorker.ReportProgress(0, new PointF(1.0f, 1.0f)); } cap.Close(); // This line is never executed } } } The "cancel" member is set to true in RunWorkerCompleted event handler. The problem is that cap.Close(); is not called, when exiting the app. Where should it, so it would be executed when I exit my app? Thanks in advance
  11. DirectShow .NET and .NET basic questions

    It turned out to be very simple. I've created a Camera class that inherits from Panel and copied most of the code from DirectShow.NET sample. And it works.
  12. Hi, I've never done anything with .NET library and I'd like to create a basic app that captures video from a camera. In DirectShow .NET samples there's a sample that does exactly that, but there's everything in a single class that inherits from Form. 1. On which containers can I display a video? I.e. I've got a TabControl with 2 TabPages - can I display captured video on a TabPage? Or do I have to add some other container (another Form, Panel?) to this TabPage? 2. (less important for now) Is it possible to create a "camera component"? So I could just add this component like any other .NET component (i.e. Label) to a container and it would take care of everything i.e. find a camera, create its own container to display the video in etc. Thanks in advance
  13. Thanks! Lucas-Kanade tracker implemented in OpenCV is exactly what I need. I'll try to create a basic app using this library (or its C# port - SharperCV) and later implement this algorithm by myself, because the libraries are just too big (~2mb).
  14. Hi, Recently I've read that someone wrote a mobile game that can be controlled without using any keys, but (as you probably guessed already) using only built-in camera to determine tilt of the phone. Do you have any idea how it could be done (please remember that it should work on mobile phone, maybe pocket pc)? Is it even possible?