secile / UsbCamera

C# source code for using usb camera and web camera in WinForms/WPF. With only single CSharp source code. No external library required.
MIT License
179 stars 55 forks source link

Can you make the class public? #9

Closed Mrgaton closed 1 year ago

Mrgaton commented 2 years ago

I want to make the class public for acces the webcam from diferents files of codes thanks

secile commented 2 years ago

Thank you for your request and sorry for late reply.

I want to confirm. What you request is that UsbCamera class's access modifier is currently 'internal' and change it to 'public'?

Could you tell me the reason. Are you going to make UsbCamera class to dll? Thank you.

Mrgaton commented 2 years ago

i mean i like to put the class in my Data.cs And make Public class for acces the camera class from other parts of code

Mrgaton commented 2 years ago

image

Mrgaton commented 2 years ago

all thath tring to do this image

Mrgaton commented 2 years ago

i use your class to my c# webcam online server and is so good

secile commented 2 years ago

To make UsbCamera class public, you have to make DirectShow class (in line 772) public too. Could you try it?

Mrgaton commented 2 years ago

oh yea it works thanks man one question how i can get the device max frame ratte?

or someshimg like image

secile commented 2 years ago

You can get max/min frame interval from Caps.MinFrameInterval and Caps.MaxFrameInterval in VideoFormat member. The value means duration in 100-nanosecond unit. You can translate into frame rates as follows.

frame rate = 10,000,000 / frame duration. (for example, value=333333 means 30 fps.)

You can change frame interval by modifying TimePerFrame value in VideoFormat member from MinFrameInterval to MaxFrameInterval, but as long as I tested, devices all I have returns same value in MinFrameInterval and MaxFrameInterval.