Camera plugin crosshairs?

This is where you talk about Plugins. How they are made and how they work, show examples.

Camera plugin crosshairs?

Postby Robertspark » Mon Nov 06, 2017 5:48 pm

With regards to the camera plugin, I was wondering what was used to overlay the crosshairs on the camera plugin?

Opencv?

Engine CV?
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2104, Neuron Lite.
UCCNC v1.2104 Macro Manual
Robertspark
 
Posts: 689
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Camera plugin crosshairs?

Postby cncdrive » Mon Nov 06, 2017 6:01 pm

Windows GDI+
cncdrive
Site Admin
 
Posts: 1860
Joined: Tue Aug 12, 2014 11:17 pm

Re: Camera plugin crosshairs?

Postby Mallemann » Wed Mar 28, 2018 5:41 pm

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.
Attachments
WebCam.zip
Camera Plugin and App
(789.24 KiB) Downloaded 33 times
Mallemann
 
Posts: 7
Joined: Sat Mar 24, 2018 8:50 pm

Re: Camera plugin crosshairs?

Postby dezsoe » Thu Mar 29, 2018 8:49 am

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 584 times
dezsoe
 
Posts: 420
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Camera plugin crosshairs?

Postby Mallemann » Thu Mar 29, 2018 9:22 am

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.
Mallemann
 
Posts: 7
Joined: Sat Mar 24, 2018 8:50 pm

Re: Camera plugin crosshairs?

Postby dezsoe » Thu Mar 29, 2018 10:17 am

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.
dezsoe
 
Posts: 420
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Camera plugin crosshairs?

Postby cncdrive » Thu Mar 29, 2018 10:23 am

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.
cncdrive
Site Admin
 
Posts: 1860
Joined: Tue Aug 12, 2014 11:17 pm

Re: Camera plugin crosshairs?

Postby Mallemann » Fri Mar 30, 2018 5:27 pm

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!
Mallemann
 
Posts: 7
Joined: Sat Mar 24, 2018 8:50 pm

Re: Camera plugin crosshairs?

Postby Mallemann » Sat Mar 31, 2018 10:21 am

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.
Attachments
Error.txt
(7.58 KiB) Downloaded 21 times
Error.JPG
Mallemann
 
Posts: 7
Joined: Sat Mar 24, 2018 8:50 pm

Re: Camera plugin crosshairs?

Postby cncdrive » Mon Apr 02, 2018 10:11 pm

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.
cncdrive
Site Admin
 
Posts: 1860
Joined: Tue Aug 12, 2014 11:17 pm

Next

Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest