c# - Webcam Capture Resolution issues -


i'm making own webcam timelapsing application, having issues webcams. 1 in particular advertises can take 5mp photos, runs native 320x240 (or horrible) feed i'm getting.

i'm using code seems copy-and-pasted across web, incarnation i'm using access webcam here http://www.planet-source-code.com/vb/scripts/showcode.asp?txtcodeid=1339&lngwid=10 , uses avicap32 access webcam, call looking this

mcaphwnd = capcreatecapturewindowa("webcap", 0, 0, 0, m_width, m_height, this.handle.toint32(), 0); sendmessage(mcaphwnd, wm_cap_connect, 0, 0); sendmessage(mcaphwnd, wm_cap_set_preview, 0, 0); 

i've tested 2 other webcams (one in built laptop, 1 oldie had kicking around) , both of seem respectable resolutions.

i've modified webcam_capture code attempt take ridiculously high-res image

//private int m_width = 320; //private int m_height = 240; private int m_width = 1600; private int m_height = 1200; //private int m_width = 3200; //private int m_height = 2400; 

using few different resolutions, seen above.

my gut tells me need make webcam use different resolution, since seems defaulting native value.

thoughts?

i'd happy post more code i'm using, seems meat of it. wm_set_preview may need explaining, it's api constant.

public const int wm_cap_connect = 1034; public const int wm_cap_disconnect = 1035; public const int wm_cap_get_frame = 1084; public const int wm_cap_copy = 1054; public const int wm_cap_start = wm_user; public const int wm_cap_dlg_videoformat = wm_cap_start + 41; public const int wm_cap_dlg_videosource = wm_cap_start + 42; public const int wm_cap_dlg_videodisplay = wm_cap_start + 43; public const int wm_cap_get_videoformat = wm_cap_start + 44; public const int wm_cap_set_videoformat = wm_cap_start + 45; public const int wm_cap_dlg_videocompression = wm_cap_start + 46; public const int wm_cap_set_preview = wm_cap_start + 50; 

any ideas welcome! robg

there has been no code shown set camera. default low resolution might applied. ideas:

  1. to not use video windows - api obsolete, limited , not flexible programmatically. anyway, wm_cap_set_videoformat message set webcam , change resolution. consider using directshow or media foundation instead.

  2. windows sdk provides graphedit tool can build capture pipeline interactively , in particular inspect available resolutions.

  3. check camera spec: 5 mp stills not mean resolution available streaming video. video res might 1/4 of that, should better 320x240.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -