Page 1 of 2

Camera plugin crosshairs?

PostPosted: Mon Nov 06, 2017 5:48 pm
by Robertspark
With regards to the camera plugin, I was wondering what was used to overlay the crosshairs on the camera plugin?

Opencv?

Engine CV?

Re: Camera plugin crosshairs?

PostPosted: Mon Nov 06, 2017 6:01 pm
by cncdrive
Windows GDI+

Re: Camera plugin crosshairs?

PostPosted: Wed Mar 28, 2018 5:41 pm
by Mallemann
Here is a Camera Plugin with complete Camera Position Finder and Offset Setup. Including a crosshair in the Cam App.See Readme File for Instructions how to install and use.

Re: Camera plugin crosshairs?

PostPosted: Thu Mar 29, 2018 8:49 am
by dezsoe
Nice work! But!

- Why don't you build the camera into the plugin? Why does it have to be in a different folder with an .exe and not built into the .dll?
- Use Application.StartupPath to find UCCNC folder. I have no C:\UCCNC folder. :)
- Use Try-Catch or IO.File.Exists to handle errors while starting camera: if there's no C:\UCCNC\Webcam\WebCam.exe then UCCNC crashes.
- I minimized the camera, and because there's no taskbar icon, I started again. Alt-Tab helped.
- Save offset first try: error (see picture), second try: data saved to desktop! Why don't you save to the profile? (UC.Writekey("MyCamera", "XOffset", xOffs.ToString()); etc.)

saveoffset.png
saveoffset.png (8.91 KiB) Viewed 27300 times

Re: Camera plugin crosshairs?

PostPosted: Thu Mar 29, 2018 9:22 am
by Mallemann
Thanks for your comments. There would certainly some work to do to make this more generic. Current Restrictions are:

- The WebCam requires .NET Framework 4.5. This conflicts with UCCNC Plugin Interface. For now, I decided to leave the WebCam.exe alone.
- the dll assumes a Standard UCCNC installation in C:\UCCNC with write access on the UCCNC directory

I will update this and work on the issues you mentioned. For now, it serves the purpose its built for, and no, its not very generic.
I was missing the crosshair and a target circle I can adjust in size and color. That's actually why I built this.

If you want to modify it to fit your environment, I can share the Visual Studio Projects, no problem. Just let me know.

Re: Camera plugin crosshairs?

PostPosted: Thu Mar 29, 2018 10:17 am
by dezsoe
No, thanks, it was only an advice. (I have my own version in Visual Basic in development phase since more than 2 years... :)) As UCCNC can run even from a USB drive, I never make anything constant, only relative from Application.StartupPath.

Re: Camera plugin crosshairs?

PostPosted: Thu Mar 29, 2018 10:23 am
by cncdrive
Hi and welcome,

Thank you for making the plugin.
Question:

- Why does the WebCam requires .NET 4.5? Is it required by some libraries the plugin uses? Isn't it possible to recompile that to .NET 4.0 then?
The thing is that .NET 4.5 is incompatible with Windows XP. This is why we did not upgrade the UCCNC to a higher than the 4.0 framework,
because then it could not run on Windows XP, because the .NET 4.5 framework can't be installed on XP.
- I think it should not be assumed that the UCCNC is in the C:\UCCNC folder. Many people installing it to second/third etc. hard drives in the computer, e.g. E:\UCCNC etc.
My suggestion is to use the Application.StartupPath string plus the subdirectory path you want to write to for the keys reads and writes and then the plugin will work with all installations.
Or you can save the keys to the current profile file with the Writekey and Readkey functions and then all machine profiles can have their own settings which is the nicest solution in my opinion.

Re: Camera plugin crosshairs?

PostPosted: Fri Mar 30, 2018 5:27 pm
by Mallemann
Hi,
I can implement the webcam code directly in the plugin. It compiles even under .net 2.0. But: if I then run the plugin, UCCNC throws an error.

I am away from my computer now but will reproduce and let you know. I would absolutely prefere to have the webcam directly in the plugin form but doesn’t work. Will send you some details soon.

But BTW: I like UCcNC. Was using mach 3 and 4 and bCNC before. UCCNC in combination with UCT300ETH and UB1 is really cool!

Re: Camera plugin crosshairs?

PostPosted: Sat Mar 31, 2018 10:21 am
by Mallemann
Here is the Error I get under the following conditions:

- Integrated the WebCam App directly on the Plugin form
- Compiled against Target Framework .NET 2.0 without any Errors or Warnings
- When I start the Plugin, this Error comes up
- the Plugin without the WebCam Code (calling the WebCam as a seperate .exe) works.

Re: Camera plugin crosshairs?

PostPosted: Mon Apr 02, 2018 10:11 pm
by cncdrive
It looks to me from the error text that the plugin can't load something.
Do you load or reference other libraries, dll files in your plugin?

Also a question is which UCCNC version are you running?
If you running 1.2102 that test version has a problem with not be able to load 3rd party plugins which had different appdomains and targeted different than .NET 4.0, the issue was fixed in 1.2103 though.